Let’s be honest; Microsoft Azure is a playground for the more technically savvy crowd. In our previous post, we discussed website hosting and the related costs associated with it.  While Microsoft Azure may be an affordable option, the ease of use and the challenging steps for deployment will likely be off-putting for you.

With that said, you’ll find the instructions to create or ‘map’ a custom domain below along with a full explanation of things to consider and what is available to you.

Hint: If you still need help getting started with hosting your website and uploading your content, see our last article for full details. 

Domain Names on Azure: The Fine Print 

Creating Your Website’s Custom Domain in Microsoft Azure is an important step in keeping your website accessible. If you’ve already set up your website, you may have noticed that the URL is quite unfriendly. While you can create your website’s custom domain in Microsoft Azure, you should know two things to consider: 

  • First, you can only map subdomains to the Microsoft Azure static website endpoint (for example, www.example.ba will work, while mapping a root domain example.ba will not work ). Though there are workarounds for that also, keep reading. 
  • Second, if you want to serve your website over SSL (Secure Sockets Layer, the encryption protocol that keeps your internet connection secure), you have to use the Azure CDN (Content Delivery Network). Though it isn’t free, Azure CDN’s pricing starts at $0.081 per GB (outbound transfer), which is still a very affordable option considering that static websites are really small.  

If neither of these considerations is a gamechanger, continue reading for instructions on setting up your custom domain name. 

How to Map Your Custom Domain Name 

To start creating your website’s custom domain in Microsoft Azure (for HTTP-only access), follow these steps: 

  1. Take your Azure Storage Static Website Primary Endpoint link and remove the https:// and the trailing / from it. 
    • I.E. https://kdstaticwebsite.z1.web.core.windows.net/ becomes kdstaticwebsite.z1.web.core.windows.net 
  1. Go to your Domain registrar or your domain NameServer hosting provider, such as GoDaddy, and create a CNAME record to point to your Azure static website endpoint host name.
    • A CNAME record is a type of DNS (domain name system server) record that maps a source domain name to a destination domain name, I.E., customdomain.com and www.customdomain.com would send you to the same website.  
  1. Create a CNAME under your desired custom Domain.  
    • I will create a kdstatic.staging.staging.networkantics.com CNAME (the subdomain is required, root domains are not supported) pointing to the A record (A record is our stripped Azure Storage Static Website Primary endpoint link) kdstaticwebsite.z1.web.core.windows.net 
  1. Go to Azure portal -> Static website Azure storage account. 
  1. Under Security + networking, select Networking. 
  1. Switch to the Custom domain tab at the top as seen in the image below.  
  1. Under Domain name, type in the CNAME domain record you created before. 
    • I.E., kdstatic.staging.staging.networkantics.com 
  1. Click on Save. Your domain is verified.
Computer screenshot of Azure configurations - Setting CNAME domain

 

  1. Navigate to Storage Account’s Settings -> Configuration. 
  2. Set Secure transfer required to Disabled.

 

Computer screenshot of Azure configurations - Setting secure transfer required to disabled
  1. Navigate to the target domain and please your eyes with the sight of your static website!
Computer screenshot of a website with a custom domain

Note: If  you’d like to be creating your website’s custom domain in Microsoft Azure mapped with HTTPS enabled (and you definitely want to have that for increased security), you would need to enable it and configure the Azure CDN service. Once configured, you can have HTTP to HTTPS redirection enabled as well – in other words, you could revert the Secure transfer required option to Enabled. 

You can get guidance on how to do that on Microsoft docs.

Other Options for the Tech Savvy

If you opt to take the HTTPS road for hosting your main website, you can create a Domain Forwarding/Redirection on your Domain Registrar and/or NameServer hosting service. In this case, you would map the Azure static website to your WWW subdomain (www.yourdcustomdomain.com) and then redirect all traffic from your root domain to the subdomain that is connected to your Azure static website (forward/redirect all traffic from yourcustomdomain.com to www.yourcoustomdomain.com ). This is the easiest option if you’re wanting greater security for your website. 

Our less-recommended option, due to the extra work that’s required, is mapping your root/apex domain to the Azure Storage hosted static website. 

DNS protocol prevents the root domain, in our example staging.staging.networkantics.com, from being assigned as a CNAME, meaning that this domain must be an A or AAAA DNS record and point to the IP address. 

So, mapping your apex or root domain to your Azure Storage hosted static website primary endpoint or to your CDN profile requires CNAME flattening or DNS chasing, a mechanism where the DNS provider recursively resolves the CNAME entry until it hits an IP address. This functionality is supported by Azure DNS, though there are other DNS providers supporting CNAME flattening or DNS chasing like Cloudflare for example. 

If you’d like more information, Microsoft provides plenty of guides, including this one as well as a second one. 

Creating Your Website in Azure Summary 

Creating your website’s custom domain in Microsoft Azure is a must for anyone promoting their business online. If you host with Microsoft Azure, you’ll want to consider your website’s security and the fact that it’s only possible to map to subdomains. However, we hope that the instructions we’ve provided for mapping your custom domain name assist you if you’ve decided to take the dive.  

Leave A Comment