Using a custom domain name for an Azure Website

The migration of TechKB.onl to Azure was a relatively easy process. The first part involved creating a new WordPress website from a template in Azure and import the contents from the original blog site. The most complex part was assigning a custom domain name to the website.

By default the Azure website is created as a subdomain to .azurewebsites.net so in the case of this blog techkb.azurewebsites.net. This isn’t ideal in the real world, so as you would expect, it is possible to assign a custom domain name .

The general steps involved in the process are:

  1. Purchase your domain name from your preferred supplier
  2. Setup DNS records that map your domain to your Azure website
  3. Add the custom domain name to your website from the Azure Portal.

I wont be going into depth about purchasing your custom domain name as part of this post, but there are many Domain name registration sites out the such as 123-reg and godaddy and the process around choosing and purchasing one is pretty much generic across the board.

After acquiring your chosen domain name, the next step is to setup a couple of DNS records which will require knowing the virtual IP address of the Azure website. To find this open the Azure Portal, browse to the Websites tab, select your website then click on Dashboard. You should then have the option to click on Manage Domains on the bottom menu bar.

NOTE: If this option is disabled, make sure you are using Shared, Basic, or Standard mode. For more information, see How to scale websites.

website01

Clicking on the Manage Domains button opens a popup window which should have the virtual IP that is assigned to the website located at the bottom.

website02

Once a note of the virtual IP address has been made, two DNS records are required to get things working. Log in to your domain registrar and use their tool to add an A record and CNAME record. In many registrar tools, you will just type the subdomain portion of your domain, not the entire domain name.

Also, many tools use ‘@’ to mean the root domain.

For example:

When creating an A record, Azure also requires a CNAME record, which is used to validate the website and verify that you own the domain name you are attempting to use. This CNAME record must have the following form: