So you are all setup with your production website using continuous deployment from your master branch and everything, but you are still stuck with this <yourappname>.azurewebsites.net URL and would now like to have it use your well thought of custom domain name. It’s fairly easy provided you have access to your DNS registry.
Brand new website
When your site is new it’s pretty simple:
- In the Azure portal in your website blade:
- Click on custom domains then Add hostname
- enter the hostname you wish
- if you click validate now it will fail
In your DNS registry you must now add new CNAME entry that will point from your desired hostname to your <yourappname>.azurewebsites.net once that is done you can now click on validate and your good to go
Existing website without traffic disruption
This one is pretty simple but not much broadcasted. It’s basically the same procedure as a new website, but in your DNS you must add a TXT entry with a value of awverify.<your desired hostname> that points to your <yourappname>.azurewebsites.net. Once this entry has been added in your DNS you can now validate your hostname in azure and it will work. The only caveat is that your website must not be in the same resource group as the one that already exists otherwise you may experience errors when trying to validate the host name.