Whenever we deploy any Azure Web apps, they will have the name of the Website with .azurewebsites.net domain provided by Azure but for production, you may need another custom domain of yours, which you may have bought or are thinking to buy. Once you have bought the same, you have to configure DNS of the domain name to point to an Azure. There are two methods to do so, where one is A method and the other is CNAME method. In A method, you have to resolve the domain name to the IP address. You get from an Azure portal by adding a A record in the DNS settings. You also need to verify the domain ownership by adding a CNAME value awverify.mywebsite.azurewebsites.net, where mywebsite is the domain name; you are holding. Thus, anyone going for mywebsite.net will be forwarded to mywebsite.azurewebsites.net. The other way is the CNAME way, which can be done without the verification in which you can just add a mywebsite.azurewebsites.net value to the CNAME. It is not possible to configure a custom domain for an app in free tier.
In the steps given below, I will show how to configure a custom domain to my Website published in the previous article. I am using a domain, which I already own www.campusplusplus.com for the demo.
You can see the custom domain option on the dashboard of the app Service. Now, you can see that Microsoft itself is providing you an option to buy a domain from the dashboard, if you haven’t bought it yet.
They are also showing the IP address, which you can configure to and under the assigned hostnames; they are showing the default .azurewebsites.net domain only.
Click Add hostname option and you can see the Window given below to validate whether the hostname can be assigned with this or not.
On validating, it will be give the details to be configured in the DNS of the domain name and will check whether it has been configured or not. (Here, I have already configured it on my DNS settings of my domain).
Click on add host name and it will be updated in an assigned hostname session. Some domain service providers may take some time to get it reflected here. Thus, wait and you can access the Website from your domain.
The same will be reflected in the dashboard of the Website also.
On the successful completion, you can check, if it is running and don’t forget to clear your cache, if it is failing.