Skip to content
  • View menu
  • View sidebar

Ricardo Sanchez

Programmer, writer, photographer, and travel enthusiast

  • Coding
  • Español
  • Photos
  • Travel
  • Support our writing
  • Contact
  • Instagram
  • Twitter
  • YouTube

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • January 2022
  • November 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • July 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • February 2018
  • November 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • January 2017
  • December 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • March 2016
  • February 2016
  • December 2015
  • November 2015
  • September 2015
  • August 2015
  • July 2015
  • January 2015
  • November 2014
  • October 2014
  • September 2014
  • July 2014
  • June 2014
  • April 2014
  • March 2014
  • December 2013
  • October 2013
  • September 2013
  • August 2013
  • June 2013
  • May 2013
  • April 2013
  • February 2013
  • January 2013
  • August 2012
  • July 2012
  • June 2012
  • April 2012
  • February 2012
  • August 2011
  • May 2011

Meta

  • Register
  • Log in

Month / September 2018

September 11, 2018February 26, 2019 by Ricardo Sanchez

How to serve your static content from Azure blob with Azure’s CDN

  • Coding
  • azure blob, azure cdn, storage account
  • 1 Comment

You are using Azure and have managed to move some of your images to blob storage, that’s great, but you know what’s better? Using a Content Delivery Network (CDN) to improve the load speed and availability of your images. Azure’s CDN is there to help you with that.

cdn-overview

Main disadvantage of using a content delivery network (CDN)

Cost and in some cases, it adds complexity as it is something else you have to setup and maintain.

Main advantage of using a CDN

An increase in the speed in wich static content like images are delivered to your users.

When to use a CDN?

When the cost is feasible and you have static content to serve (images, scripts, CSS, etc.).

Is a CDN a performance booster?

It is as it can decrease the number of nodes that a file has to go through to get to where the user is.

How do we setup a CDN in Azure?

Assuming that you already have images on blob storage, when you go to your Azure portal and browse to Storage Accounts > your blob you should see something similar to the screenshot below, with your own images instead of mine of course 😉

bloblstorage

The step above is just to confirm that you have in fact, some images already in your blob storage. Adding the CDN on top of it is simple, and it will help your images load faster than ever before, promise.

Go to Storage Accounts, select your storage account (in my case I choose the one labeled developerstash) and then click on Azure CDN as shown below:

bloblstorage_cdn

After you click on Azure CDN, you’ll add the following values needed to create a new endpoint to your new CDN.

CDN Profile name: I often use the same name as the CDN endpoint name, but you can type whatever you want.

Pricing tier: There are four options available, for this example, I choose Standard Microsoft – Preview since this is the most economical option as of now.

CDN endpoint name: An endpoint is a URL that you’ll use to access your images through CDN.

Origin hostname: This should be filled in already with the location of your blob storage, do not change it unless you want to pull images to the CDN for a different blob storage account.

bloblstorage_cdn_newendpoint

After you click Create, it takes a few minutes until your new CDN endpoint is ready to be used.

To access these images using the CDN endpoint just append the blob storage directory and the file name you want to view. For example, below are two links that point to the same image, one using the blob URL and the other one the CDN URL:

Blob: https://developerstash.blob.core.windows.net/img/Azure150x150.png

CDN: https://cdndeveloperstash.azureedge.net/img/Azure150x150.png

Important: It can take at least an hour until the content is being populated, during that time the CDN return 404.

Happy coding!

Create a website or blog at WordPress.com
  • Follow Following
    • Ricardo Sanchez
    • Join 126 other followers
    • Already have a WordPress.com account? Log in now.
    • Ricardo Sanchez
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...