How to Put Stuff on an Azure CDN

(Note: This post is originally from 2020, and is copied to this new site for historical reasons. Opinions, network infrastructure, and other things may have changed since this was first written.)

I’ve been experimenting with Azure. Most of it is pretty straightforward, but one complex operation is getting a working content delivery network. There’s a lot of things you need to set up.

Sidebar: Your first $200 are free

When you register a new account with Azure you get $200 worth of credit for all possible Azure services, which is fantastic from an educational standpoint. You can basically set up whatever kind of cloud network you need and it won’t cost you much until it actually takes off.

Where do files live? Azure Storage.

The first thing you need to do (besides set up your first resource group, if this is your first time with Azure at all) is to set up a storage account. You’ll want to set it as a public endpoint with Microsoft routing (which should both be default settings), allow public blob access, and go ahead and leave it on hot access for right now. And get the storagev2, it’s easier.

Once you’re in the account, you’ll want to open the storage explorer and create a new blob container (right click the BLOB CONTAINERS category). Name it whatever you like (I’ll use record) and make sure it’s at a public access level. I’ve been using “container” but “blob” might work too.

You can use this Storage Explorer to upload files if you want, but the other thing to do is to use the Azure CLI tool:

$ az storage blob upload \
  --account-name storage-account-name \
  --container record \
  --name destination-filename.png \
  --file source-filename.png

How do you get there? Azure CDN.

Once your storage account is set up, you’ll want to click the Azure CDN listing in its settings. You can create all the relevant Azure resources from within that wizard. The wizard will ask you to pick a subdomain of (e.g., which is guaranteed access to your CDN. You can add a custom domain to it in the custom domain tab of the CDN endpoint, which is basically a CNAME record that they set their own HTTPS certificates up for.

Accessing the file follows this URL scheme (replace azureedge with your custom domain as appropriate):

To access “favicon.png” in the “index” container:
  • October 21, 2022