Reviewing Azure Content Delivery Network
Azure Content Delivery Networks (CDN) offers a way to deliver data efficiently on a global scale. CDNs typically cache content on more than one server in order to guarantee that when a user requests data, the data is on a server close enough to them to minimalize the amount of time the user has to wait for that data. Azure installs CDN data on servers in point-of-presence (POP) locations all around the world to efficiently deliver data, regardless of the user's location. Azure often uses something called a cache, which is a set of previously-stored data, to serve to users, so that new information doesn't have to be requested and received every time. This greatly reduces the latency, or wait time, the end-user experiences.
In this Lab Step, you will learn the fundamentals of Azure CDNs by working hands-on with one.
1. At the top-left of the Azure Portal, click the portal menu > All resources:
2. In the All resources blade, click the Storage account beginning with storage:
An Azure Storage Account contains your stored data objects in Azure. Azure CDNs use storage accounts to store data, and when data is requested by an end-user, the CDN searches for that data in a storage account.
3. In the Storage account menu, under Security + networking, click Azure CDN:
Notice that a CDN endpoint has already been provisioned:
Note: If you don't see an endpoint here, reload the page every few minutes until you do. It can take up to 10 minutes for the CDN to propagate.
4. Copy the endpoint of the CDN and paste it into a new browser tab:
Notice that currently, the endpoint results in a "Page not found" message. Currently the CDN points to a storage network that has no files stored on it. Next, you'll upload a file to the storage account and see it take effect on the CDN.
5. Use the Cloud Shell button you discovered in the previous Lab Step to open the Cloud Shell, if it's not already open:
touch example.html into the terminal and press enter to create a file called example.html.
7. Click at the top of the Cloud Shell to open the Editor:
8. Click example.html in the Files menu to open example.html.
Hello from the Azure CDN! into the Editor on the right and press ctrl+s on Windows or Linux, or cmd+s on mac to save the file.
10. Click the ... at the top-right of the editor and click Close editor:
11. In the terminal, enter the following command and press enter:
Copy codestorage_account=$(az storage account list --query .name -o tsv)
This command will save the name of the storage account you're working with to a variable called
echo $storage_account to confirm the command worked:
13. In the terminal, enter the following commands and press enter:
Copy codeaz storage container create --name calabscontainer --account-name $storage_account --public-access blob
az storage blob upload --container-name calabscontainer --account-name $storage_account --name example --file example.html
The first command will create a container, which is a service used to segment data within storage accounts. The second command uploads the file you created as a blob to the container.
The end result is that example.html has been uploaded as a blob named example to a container, calabscontainer, which resides in the storage account you discovered earlier. If you'll recall, the CDN searches the storage account it's deployed to for resources, so you should be able to access your file through the CDN now (after adequate time to allow the file to propagate to the CDN POP locations).
Warning: The two commands will output a warning regarding authentication, don't worry about that and go to the next step.
14. Click the X at the top-right of the Cloud Shell to close it.
15. In the Storage account menu, under Data storage, click Containers:
16. Click calabscontainer:
Notice that the blob named example is there, which means it was successfully uploaded to the container. Click example:
17. In the resulting Blob blade, notice the URL field near the top. The URL corresponds to the URL of the blob in the storage account. Click the icon to the right of the URL to copy it:
18. Paste the URL into a new browser tab:
Despite the message, you have accessed the blob directly and not through the CDN. To access the file through the CDN you must use the CDN endpoint.
19. Replace the URL domain with your CDN endpoint (preserving the /calabscontainer/example path):
Most likely you will get a Page not found message, since as you'll recall the CDN stores data in servers around the globe, so propagation can take a bit of time (up to 90 minutes depending on the CDN configuration). That being said, if you were to wait long enough and refresh the page you would see the message you saved in example.html. This is how Azure CDN serves content stored in Azure efficiently to end-users around the world. It is also worth noting that you can use a custom domain with your Azure CDN so you can use your company's web domain rather than the default CDN endpoint ending with .azureedge.net.
In this Lab Step, you learned how to navigate to a CDN using an Azure Storage account. You also learned what a CDN is and why it might be used. Finally, you learned how CDNs serve data efficiently around the world and where they get their data from.
Check if the blob container has been created