Suppose you wish to link your own custom domain to your azure website. As an example, let us assume that we wish to use a custom name like http://code.zift.ca instead of the default name of http://supersite.azurewebsites.net. This tutorial takes you through some very simple and short steps to achieve this.
Before we proceed, it is assumed that you have the following:
- You must have a domain name that you already own.
- You have an Azure subscription
2) Click on your web application in Azure. In the example below, my azure website is named CodeFirstStuff2.
3) In the second blade, find and click on “Custom domains”.
If, in the third blade, you see a message “Click here to upgrade your App Service to assign custom hostnames to your app.”, then it means that you need to upgrade from the free tier to one that supports custom domains. Click on the above message and you will be reminded that your pricing tier is “F1 Free”, which does not support custom domains. The next tier up is pricing tier “D1 Shared”, which does support custom domains. It, however, costs $11.76 per month (at the time of writing). If you are OK with this additional cost then click on pricing tier “D1 Shared”, then click on the Select button.
4) If the third blade looks like below, then you are indeed able to create a custom domains for your Azure website:
Note the name at the bottom of the above blade. In this demo it is codefirststuff2.azurewebsites.net. You will need this address in the next important step where you will configure a CNAME DNS record to point to your {your web app name}.azurewebsites.net.
5) This next step involves your domain name registrar. Examples of some domain registrars are: godaddy.com, namecheap.com, fatcow.com, hostgator.com, etc …
Go to your domain registrar and add a CNAME host record that points to the hostname assigned to your Azure site. This is what my CNAME record looked like with my Canadian registrar, where I configured domain name zift.ca to use a host name code:
If you are unsure about how to configure the CNAME DNS record, then contact your domain registrar’s support desk and they will be happy to help you.
To prove that your DNS name change has indeed propagated, you can always use a website named https://www.whatsmydns.net/. Here’s what it looked like for me:
You can see from the above evidence that the CNAME DNS record change that was made has propagated across our planet (except for Paris, France). Now we can configure Azure with the new host name.
6) Return to Azure’s portal.
Click on “+ Add hostname”.
The following will appear in the fourth blade:
7) Enter the fully qualified custom address into the Hostname field (example: code.zift.ca), then click on the Validate button.
If you get two OKs at the bottom then you are good to go.
Click on the “Add hostname” to save your changes.
The real test comes by trying out your custom domain. Point your browser to your custom domain (Example: http://code.zift.ca) and make sure that your website is successfully loaded. I am happy to report that it worked for me when I pointed my Microsoft Edge browser to my custom domain name.
No comments:
Post a Comment