Configuring a custom domain for Azure website

Azure websites are distributed to the common azurewebsites.net domain. If your website title is contosoweb then it can be accessible at the URL contoso-web.azurewebsites.net. This might be acceptable during the development and testing. Once you are heading towards the release of your website, you will probably want to configure a custom domain for the website. You need to follow the below-listed steps to configure a custom domain.

  1. Get a custom domain from a domain registrar according to your preference.
  2. Use your domain registrar’s update DNS option to add DNS records for your domain.
  3. Connect this domain with Azure website.

Adding DNS records

You can add your DNS records using domain registrar which can be either a CNAME or A record. A record points a domain to a particular IP address. Speaking of Azure websites, this IP address is the IP address of the cluster of servers on which your website is functioning. Though this is not the IP address of a particular virtual machine. You can easily get your IP address for your A record from the management portal by simply clicking the domains and SSL part in the website blade. It will immediately open the SSL settings blade for your website as illustrated in Figure 1.

Custom domain for Azure website 1

FIGURE 1 Locating the IP address to use for A recordsIf you are using an A record then you are required to add a CNAME record to confirm that you are owning the domain.This CNAME must be formatted as awverify.<yourdomain>.com and map to awverify.<your website name>.azurewebsites.net. Table 1 shows how the A and CNAME records are defined for the custom domain contoso.com.

RECORD TYPENAMEVALUE
Acontoso.com23.100.46.198
CNAMEawverify.contoso.comawverify.contoso-web.azurewebsites.net

TABLE 1 Example DNS records when using A records to configure a custom domain

The awverify CNAME can only be used when using an A record to configure a custom domain. If you are using a CNAME record, then your DNS records will probably show the custom domain and the Azure website URL. Also, it is likely to map subdomain. Below is the Table 2 showing an example of how a CNAME record can be defined for a custom domain contoso.com.

RECORD TYPENAMEVALUE
CNAMEcontoso.comcontoso-web.azurewebsites.net

TABLE 2 Example DNS record when using CNAME records to configure a custom domain

Associating the custom domain with the website

When you confirm the CNAME records, the final step is to point the custom domain to your Azure website. You can use management portal to do so. Click on Manage Domains button and add the custom domain. Also, you can add the custom domain using the Set-AzureWebsite cmdlet as shown below

Set-AzureWebsite -Name "contoso-web" -HostNames @(www.contoso.com, "contoso.com")

Note: Custom domains are not supported in the free tier of Azure Websites.

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

article

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More
article

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More
article

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More
article

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More
article

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More