Azure – Networking – Part 9 – Configure Custom Domain In Azure DNS

Hello Friends,

Today we will start our discussion with a new important networking concept is DNS ( Domain Name system). As we discussed in one of our old article that DNS is responsible for translating or resolving a website name or service name to its IP address.

 If you have missed our previous articles, please check it in following links.

Part 4 – Network Security Group (NSG) in Azure

Part 5 – Basics of Azure Application Gateway

Part 6 – Azure Application Gateway Features

Part 7 – Create An Application Gateway With URL-Based Routing Configuration- 1

Part 8 – PowerShell To Create An Application Gateway With URL-Based Routing Configuration- 2

Following are two major benefits of hosting in azure DNS.

  1. By hosting our domains in Azure, we can manage our DNS records by using the same credentials, APIs, tools, and billing as our other Azure services.
  2. Each DNS query is answered by the closest available DNS server to provide fast performance and high availability for our domain.

There are a lots of very well described article available online. So I am not going in details about DNS. Instead I am starting with our practical exercise. In this exercise, we will see how to configure a custom domain to my Azure web app (App service).

Exercises :

Create New App Service :

To proceed with our exercise, we need an app service. Let’s create one for us by longing in to our Azure portal.

From left site menu click on App Service and add new App Service as shown in following figures.

Figure 1 : Azure Networking -DNS – Create New App Service 1
Figure 2 : Azure Networking -DNS – Create New App Service 2
Figure 3 : Azure Networking -DNS – Create New App Service 3
Figure 4 : Azure Networking -DNS – Create New App Service 4
Figure 5 : Azure Networking -DNS – Create New App Service 5

Purchase New Custom Domain :

Azure DNS does not currently support purchasing of domain names . We need to purchase our domain from one of any 3rd party domain provider. Here we have purchased following “manasmoharana.xyz” domain from GoDaddy.com provider as shown in the following figure.

Figure 6 : Azure -Networking -DNS – Purchase domain from Godaddy.com provider

we are ready with our web app in azure as well as with custom domain. Now we need to configure DNS in both Azure as well as in custom domain provider. Let’s first configure DNS records in custom domain provider.

Configure DNS Records In Domain Provider (Godaddy.com) :

Sign in to the website of our domain provider and find the page for managing DNS records. Every domain provider has its own DNS records interface. Also, we can find the DNS records page by viewing our account information, and then looking for a link such as My domains. Go to that page and then look for a link that is named something like Zone fileDNS Records, or Advanced configuration.

We can see in the following figure, we have added/configured 4 new DNS records. First add a CNAME record to map my our custom domain (manasmoharana.xyz) with the app’s default domain name (<mstechs> .azurewebsites.net.

Secondly, to successfully validate CNAME record for our custom domain in Azure DNS, we need to add two more following DNS records. If we skip these step, Azure will not validate our custom domain. In another article I have shared about the issue with custom domain validation issue in Azure.

  1. An A record to map to the app’s IP address of our App service ( mstechs.azurewebsites.net )
  2. TXT record to map to the app’s default domain name  mstechs.azurewebsites.net . App Service uses this record only at configuration time, to verify that we own the custom domain. After our custom domain is validated and configured in App Service, we can delete this TXT record afterword.

Third step is to add a CNAME record to map a wildcard name to the app’s default domain name (mstechs.azurewebsites.net).

For the home.manasmoharana.xyz domain example, the CNAME record will map the name * to <mstechs>.azurewebsites.net.

We can see all DNS records in the following screenshot.

Figure 7: Azure – Network – DNS record in Domain provider

Configure DNS records in Azure to enable CNAME record mapping :

In the left navigation of the app page in the Azure portal, select Custom domains. In the Custom domains page of the app, click add custom domain as shown in the following figure.

Figure 8 : Azure – Network – configure new DNS record

In “Add custom domain” page, type the fully qualified domain name that we added a CNAME record for, such as www.manasmohrana.xyz and click Validate button to validate the owner of the custom domain by verifying all DNS records in domain provider site as shown in the following figure.

Once it is validated the host name availability and domain ownership, make sure that Hostname record type is set to CNAME and then click Add custom domain button to proceed.

Figure 9 : Azure – Network – DNS record validated

As we can see in the following figure, it successfully added the custom domain.

Figure 10 : Azure – Network – 1st DNS record added

Same way , we have added two more domains with sub-domain as shown in following figure.

Figure 11 : Azure – Network – All DNS record added

Now we have done with all configurations. It is time for testing our custom domain. Before our configuration, the custom domain page was pointing to a site host under custom domain provider as shown in following figure.

Figure 12 : Azure – Network – Custom domain site before configuration

After configuring DNS records in both side, the custom domain pointing to our web app hosts in azure as shown in following figure.

Figure 13: Azure – Network – Custom domain site after configuration

In following figure, we can see the custom domain with wildcard domain (home.manasmoharana.xyz).

Figure 14: Azure – Network – Custom domain site with sub domain.

As I said there are very good articles available online. Find following some very good articles on DNS.

Thanks for reading  🙂

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more.

If you have any suggestion / feedback / doubt, you are most welcome. Stay tuned on Knowledge-Junction, will come up with more such articles

Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.