Azure Content Delivery Network

Azure Content Delivery Network


 

What is CDN?

CDN is basically a distributed storage system used to deliver content over the Internet to end users. CDNs serve a large amount of the content on the Internet today. The main goal of a CDN is make access to a wide range of file types like text, graphics and videos as quick as possible.

1432780065_full

 

NCDN – CDN” by KanohaOwn work. Licensed under CC BY-SA 3.0 via Wikimedia Commons.

Lets get started!

If you’d like to manage your own CDN in Azure heres what you do. First you’re going to need an Azure account and I’m going to assume you already have that. Now lets move on to getting things setup. You’ll need basically two things, a storage account to get the origin domain and the CDN endpoint. Before you can create the CDN endpoint we have to have a storage account.

Create a storage account for an Azure subscription

  1. Log into the Azure Management Portal.
  2. In the lower left corner, click New. In the New Dialog, select Data Services, then click Storage, then Quick Create.
  3. The Create Storage Account dialog appears.
    ![](https://acomdpsstorage.blob.core.windows.net/dpsmedia-prod/azure.microsoft.com/en-us/documentation/articles/cdn-how-to-use/20150304055945/includes/cdn/cdn_createnewstorageacct.png)
  4. In the URL field, type a subdomain name. This must be a unique name.
  5. From the Region/Affinity Group drop-down list, select a region or affinity group for the storage account.
  6. From the Subscription drop-down list, select the subscription that the storage account will be used with.
  7. Click Create Storage Account. The process of creating the storage account might take several minutes to complete.
  8. Verify that the account appears in the items listed for Storage with a status of Online.
  9. Create a container call “**content**”. This is the default container in the blob location where files will be stored. Choose between “Private”, “Public Blob” and “Public Container”.

    Private – No anonymous access and must provide azure storage account name and key
    Public Blob – Anonymous access to individual file by url
    Public Container – Anonymous access to the container using the REST API from the browser is allowed. So users could get a list of all the files in the container.

When your done you should end up with a URL similar to this. http://[mynewcdn].blob.core.windows.net/[content]

Create a new CDN endpoint for your storage account

  1. In the Azure Management Portal, in the navigation pane, click CDN.
  2. On the ribbon, click New. In the New dialog, select App Services, then CDN, then Quick Create.
  3. In the Origin Domain dropdown, select the storage account you created in the previous section from the list of your available storage accounts.
  4. Click the Create button to create the new endpoint.
  5. Once the endpoint is created, it appears in a list of endpoints for the subscription. The list view shows the URL to use to access cached content, as well as the origin domain.

Access CDN content

To access cached content on the CDN, use the CDN URL provided in the portal. The address for a cached blob will be similar to the following:

http://CDNNamespace.vo.msecnd.net/MyPublicContainer/BlobName/content

Must Have Tools

Using azCopy to copy data to Azure CDN

There is currently no way to upload files from within the portal. azCopy provides a way to copy files into Azure storage without the need of a GUI or writing your own code.

Install azCopy

  1. Download the latest [preview version](http://aka.ms/downloadazcopypr).
  2. Run the installation and accept all the defaults.
  3. Add the AzCopy installation location to your system path.
  4. Go to “System Properties” then click “Environment Variables”
  5. Edit the “Path” variable and append the path to “azCopy”.
  6. Open a command prompt the type “azcopy”. You should get help information for “azCopy”

Create azCopy Script

  1. Use the template script found here. ex: “azCopy /Source:**C:azureData** /Dest:**https://yourstorageaccount.blob.core.windows.net/content** /DestKey:**key** /S /XO”
  2. Add the <source> and <destination> for the CDN.
  3. Add the <destkey> for the CDN.

Using Azure Explorer

Azure explorer is a free graphical tool for managing Azure storage. So far it’s been the best free tool I’ve seen and it has a lot of capabilities. And since Microsoft does not let you upload data from the web portal you just about have to use this tool unless your a developer.

If you plan on using Azure storage this tool is a must have. Get it from http://www.cerebrata.com/products/azure-explorer/introduction.