Setup a Content Delivery Network using Microsoft Azure: Part 1

User Story:
As a developer or IT professional, I want to setup a storage system to accelerate static content, dynamic content, mobile content, e-commerce transactions, video, voice, games and so on.

This may seem like a trivial scenario, but statistics show that a second-long delay causes a 7% drop in conversions, an 11% drop in page views and a 16% drop in customer satisfaction. It becomes therefore imperative to optimize the delivery of digital artifacts to a geographically dispersed audience, in a way that minimizes latency. That is where CDN (Content Delivery Network) comes in.

Essentially, CDN puts your content in many places at once, providing superior coverage to your users. As with anything, depending on your level of comfort, you can decide to go with turn key, fully supported solution or setup a CDN for your client Apps or your organization.

My goal in this post is to show you how you can setup a CDN endpoint for your content in Microsoft Azure. The Azure Content Delivery Network (CDN) is designed to send audio, video, images, and other files faster and more reliably to customers using servers that are closest to the users. This dramatically increases speed and availability, resulting in significant user experience improvements, including but not limited to:
  • Better performance for your apps and services
  • Global distributed network
  • Highly scalable infrastructure
  • Active redundancy and failover
  • High reliability
  • Robust security

Okay, that's enough talking, let set it up:
  1. Login to your azure portal and create a new resource of type CDN (profile).

  2. Add a storage Account (This is where you will store your artifacts such as css, Javascript, videos, audio, etc). Choose the correct replication mode (I recommend the Read-access geo-redundant storage (RA-GRS), basically, it is 99.9% available even in case of entire Region Data centers outage, so says Microsoft)
    Azure Storage is a Microsoft-managed service providing cloud storage that is highly available, secure, durable, scalable, and redundant. Azure Storage includes Azure Blobs (objects), Azure Data Lake Storage Gen2, Azure Files, Azure Queues, and Azure Tables. The cost of your storage account depends on the usage and the options you choose
  3. Add a CDN endpoint Now your CDN profile is ready. Your Storage account is ready. Time to glue them together! Open your CDN profile and "Add EndPoint" (See sample below, notice the storage connection)

  4. Add your digital artifacts to the Storage account: Microsoft recently added a little neat tool called Azure Storage Explorer. Get Cloud Explorer right away from Azure site.
    Fill out the form with the details from your storage Account keys. You can select any option, but I recommend the "Connection String" or "Storage Account name and key" options. You can get the Access keys from your storage account settings in Azure, as below:
  5. Use Blob Containers to store your web site static files: With a container inside the Blob, you can grant direct access to your resources, unlike things like "File Shares" that requires SAS (Shared Access Signature).

    Important Note: Make sure to set the public access level of your container, by default it is set to "No public access"

    Your CDN is ready to go and you can start referencing your javascript or css or any other resource from the CDN

    Assuming you have a file:

    https://pacocdnstorageaccount.blob.core.windows.net/javascript/faq-js-s.js

    With your CDN endpoint connected to this storage, you can just reference:

    https://pacosoft.azureedge.net/javascript/faq-js-s.js

References:
https://azure.microsoft.com/en-us/services/cdn/
https://www.incapsula.com/cdn-guide/what-is-cdn-how-it-works.html

Comments

Popular posts from this blog

Why can't Microsoft install IIS on Window Operating Systems by default?

Exam 70-487: Accessing Data - How to choose the Appropriate Data Access Technology - Entity Framework?

Exam 70-487: Accessing Data - How to choose the Appropriate Data Access Technology - Azure Cosmos DB?