Creating and Configuring Azure DNS Resource and Setting Up a Custom Domain Name for Azure App Service Web App

Creating and Configuring Azure DNS Resource and Setting Up a Custom Domain Name for Azure App Service Web App

What is Azure DNS?

Azure DNS is a hosting service for DNS domains and provides name resolution. It’s using Azure infrastructure to provide name resolution services and it provides many benefits including seamless integration in to your other Azure Services, ease of management, Security, Reliability and Performance. You can learn more about Azure DNS from the official documentation.

Creating and Configuring Azure DNS

It’s really easy to create and configure Azure DNS and we’ll look at how we can do it now. Login to your Azure Portal and find the Azure DNS from the list of Azure Services. When you click on the Azure DNS link you will be taken to the DNS Zones blade

1-create-azure-dns-zone-resource

Here click on Add button to create a new DNS Zone. A Create DNS Zone blade will open up. Here you need to add a Name for the DNS Zone. Then select the Azure Subscription and the Resource Group you want to put the DNS Zone in. The location of the resource group doesn’t really matter since Azure DNS is a global resource. Then click on Create to create the resource.

After the DNS Zone is created you can see the overview of the DNS Zone you created. Here you can find the Nameservers you need to configure the DNS Zone with a domain name.

2-get-name-server-values-from-dns-zone

Next you need a domain name and you need to configure your domain name to use the Azure DNS Nameservers. I’m using a free domain I purchased using Freenom for this demonstration.

I have navigated in to the Nameservers section of the domain configuration for my domain and I am using the Azure DNS Nameservers as my custom Nameservers for my domain.

Setting Up A Custom Domain Name for Azure App Service Web App

We’ll use the newly created Azure DNS Zone to configure a custom domain for an App Service Web App. I have already created an App Service App and it has http://kvkdnszonedemo.azurewebsites.net as the default domain name its assigned with.

First, we need to create a Record Set to point to this Web App when we navigate to http://www.kasunk.tk To do this go to the Azure DNS resource and click on the Record Set button.

4-add-a-cname-record

In the Add Record Set blade, you need to add a Name for the record set. This name is a relative name where it’s combined with the Zone name to give the Fully Qualified Record Name. (eg. Relative name www combined with zone name example.com give www.example.com). We are using a CNAME record since we are using a fully qualified record name of the web application we created. Then you need to configure TTL and add the Alias value. Once you are done, click on Ok to add the new Record Set.

Now the record set is in to point to your web application when I navigate to http://www.kasunk.tk next we need to configure the Custom Domain from the App Service end. To do that, go to the App Service Web App and in the Settings section Click on the Custom Domains link.

5-add-the-hostname-to-web-app

In the new blade that opens up, click on the Add Hostname button and a new panel will open up to configure the custom domain.

5b-validate-and-add-hostname

In the Add hostname panel, Add the hostname (in my case its www.kasunk.tk) and click on Validate. This will check for the Record Type, Hostname availability and for the Domain ownership. Since we are using Azure DNS and the CNAME record is already setup, this will be verified quickly. After the verification completes click on Add Hostname button to complete the process and add the hostname.

That is, it. Now if you navigate to your newly added domain. (in my case its www.kasunk.tk) you should be taken to the web application.

6-hostname-added

Here I have not deployed any application to the App Service Web App, hence its showing the default page comes with it.

In conclusion, you saw how easy it is to create an Azure DNS resource and configure it. And using the Azure DNS we configured a custom domain name for an App Service Web App quite easily. This is it for this post, I will see you in the next one.

You Might Also Like
Comments