Setting Custom Domains For Azure Storage

When you create an Azure storage account, by default, it can only be accessed via it’s native name that Azure give it, in the format of http://<your storage account name>.blob.core.windows.net. This may suit your requirements, but sometimes you may want to change it so that it looks like the content is hosted at your website.  One of the main reasons would be to perhaps give your users a greater sense of security, because as far as they’re concerned they’re downloading content directly  from your website and not some unknown 3rd party (as far as they’re concerned). In this article I’ll describe how to change the URL of your storage account to make it appear as though the content is hosted on your website.

Creating Your Storage Account:

Create an azure storage account
Azure storage account details


  1. Click on “STORAGE” then new
  2. Quick create
    1. Type in the name you would like to give your storage account
    2. Select a region where you would like the storage account hosted at (pick the same as where your website is located at)
    3. For replication, choose the option which best suits you.
      1. Locally redundant means that there are backup copies, but only within the same region (So if a meteor hits that part of the earth, your files are gone forever).
      2. Geo-Redundant means that you’re images are backed up to a secondary region hundreds of miles away, so in the previous example, your files would still survive.
    4. Your storage account will now appear under the storage tab (That you first clicked on) along with your other storage accounts.

Choosing Your Custom Domain Name

Configure Manage domain
Custom subdomain name


  1. Click on your newly created storage account
    1. Click on configure, then click on “manage domain” at the bottom of the page
  2. Type in your custom domain name.
    1. It will have to be a subdomain domain name.
      You won’t be able to make it point to mysite.com/images unfortunately, it may be possible with 301 redirects but I imagine it will get messy very quickly.
      It will instead have to be something content.mysite.com, but you can have a container name (Discussed later) called “images”, so you would end up with content.mysite.com/images
    2. Using a subdomain has the benefit of improving your page speed, which will ultimately have a positive effect on your SEO efforts.
      I’ll go into detail later.
    3. At the moment, this won’t work.
      As you can see, Azure is asking you to have a CNAME record (canonical name) for your domain with your DNS provider.
      This is where it gets a little complicated, it’s a little daunting the first time, bit you’ll see that it’s very easy and not something to be scared of.

Adding DNS Records For Your Custom Domain

Domain DNS records


  1. Go to your domain host (GoDaddy for example) and navigate to your domain management page.
  2. You will see several fields:
    1. Host Name
      • The subdomain that you have chosen to for Azure to use.
    2. IP Address/URL
      • The location that Azure instructed you to point your CNAME to.
        This will be <Your storage account name>.blob.core.windows.net
        In my example, this would be mycustomstorageaccount.blob.core.windows.net
    3. Record Type
      • You’ll want to select CNAME here.
    4. TTL (Time To Live)
      • This indicates in seconds how frequently the DNS details should be refreshed for this rule.
        Setting it low initially is fine, but once you’ll got everything all set up, set this back to a longer value to make the queries required to look up the DNS records for your domain less frequent.

Setting Up Your Container

  1. Go back to Azure and it should now allow you to use the subdomain of your custom domain selection.
    • For me it worked right away, but sometimes it can take a little while to get picked up. 
  2. Click on your storage account.
    1. Don’t worry that under endpoints it still says the original Azure path representing your storage account, it’s perfectly normal.
    2. Click on “Containers” at the top of the page and then click on “Create a container”.
    3. Type in a name for your container, this will appear as if it were a sub directory under <your subdomain>.<your custom domain>/<container name>
    4. In the “Access” dropdown, select “Private” if you don’t want anyone else to see it’s contents, or “Public Blob” if you want it to be visible to everyone (Which will probably be the case if you’re trying to use your storage account to host images for your website for example).

Done

That’s it!
You’re now able to access your container and upload your blobs.
You can use visual studio in the server explorer panel to achieve this, or one of the popular Azure Storage explorers (Link http://blogs.msdn.com/b/windowsazurestorage/archive/2014/03/11/windows-azure-storage-explorers-2014.aspx)

If you enjoyed this article, please consider giving it a +1

Tags: cloud, azure, storage

Published: 6/14/2014 10:34:21 PM
By: Stephen Warren