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.
Following are two major benefits of hosting in azure DNS.
- 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.
- 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).
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.
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.
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 file, DNS 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 (
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.
- An A record to map to the app’s IP address of our App service ( mstechs.azurewebsites.net )
- A 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 (
home.manasmoharana.xyz domain example, the CNAME record will map the name
We can see all DNS records in the following screenshot.
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.
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.
As we can see in the following figure, it successfully added the custom domain.
Same way , we have added two more domains with sub-domain as shown in following figure.
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.
After configuring DNS records in both side, the custom domain pointing to our web app hosts in azure as shown in following figure.
In following figure, we can see the custom domain with wildcard domain (home.manasmoharana.xyz).
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