It is a fairly common task to setup a site in Windows Azure websites and need to have a custom domain pointed at that site. Windows Azure lets you setup a custom domain with a shared or reserved instance or a virtual machine. You cannot do this with a ‘free’ instance site. Below I will show you how to configure your Azure website with a domain registered at GoDaddy. The steps in GoDaddy may translate easily in other registrars as well, but the flow and screens may vary.
I will assume you have already created a website or virtual machine in the Azure portal and that your site runs using the Azure provided url. For instance, the default url for http://nexul.com/ is http://nexul.azurewebsites.net/.
Click on the “Configure” tab at the top of the dashboard for your Azure site. On that page you will see a “domain names” section, as shown in the following screenshot. The only default url in that section is the *.azurewebsites.net domain.
At the bottom of the domain names list, click on the “manage domains” button. In this dialog you can enter as many custom domains as you like. Enter the full www. subdomain that you want pointed at this azure website, as shown in the following dialog. Then click the checkmark to the right to save the new value.
When the dialog closes, verify that the domain you added is now listed in the custom domains section.
This section assumes you already own the domain name you configured in Azure, and that you currently access management of that domain using the GoDaddy.com website. If you are using a different registrar or have a custom DNS solution, then your experience will vary.
Start by logging into GoDaddy and going to the Domain Manager for your domain. I use the “Advanced view”. If you cannot see everything in the screenshot below, then toggle over to this view. The view selection is in the upper right are of the screen.
You can only have 1 CNAME record pointing at www. Open the DNS Manager using the ‘Launch’ link under the DNS Manager section. The DNS Manager will open in a new window.
In the CNAME section create a new record pointing www to the default domain on Azure for your site. Typically this is yourdomain.azurewebsites.net, but that could change in the future. See the Azure portal for the appropriate value. Save your changes to DNS.
If you wait for this DNS entry to propagate you would start seeing http://www.yourdomain.com/ open your site deployed to Azure. You could stop here if you don’t need the root of your domain pointed at your Azure site.
This step is optional if you don’t want the root of your domain http://yourdomain.com/ pointed at your Azure site. You can also skip the rest of the steps in other sections below if that is the case. To begin open the DNS Manager if you don’t still have it open from the previous step. You don’t have to wait for the CNAME record to propagate before doing this step.
Edit your A record (there is only 1), to point to the IP Address that the Azure ‘Manage Custom Domains’ dialog told you to create. Save your changes.
Back on the Domain Manager page, on the left side under “Domain Information” the last item is “Forwarding”. Click on the “Manage” link to the right. My screenshot shows the settings after forwarding is enabled. After the following steps in this section, make sure this section of your screen looks similar, but with the relevant detail differences.
The “Forwarding and Masking” dialog will open over your domain manager view. The dialog should say “Forward YourDomain.com to:” (no subdomain listed). Then in the textbox enter the subdomain the root of your domain should be forwarded to, such as “www.YourDomain.com”. This should be the same sub-domain you mapped in the Azure portal. Check the recommended checkbox to update your DNS settings to support this change. Then click on “Advanced Options” to see something similar to the following screenshot.
On these advanced options ensure this is set to “Forward Only”, and set the redirect type to “I am permanently forwarding my domain. (Recommended)”. This may be the default option. Then click OK.
Now that the dialog is closed you may see a message in the Forwarding section of Domain Manager that it will take some amount of time before it is effective. This is because it takes time for DNS changes to propagate. This may be 24-48 hours, or it may be less. It all depends how long until DNS entries expire in caches. Come back to the GoDaddy Domain Manager after you have waited the recommended time.
When you come back open the Forwarding Manage link button again. You should see that the domain is currently forwarding. You can also edit or remove the forwarding from this dialog if necassary. Here is a screenshot of what it should look like.
If you followed the above directions you should now be able to visit http://YourDomain.com/ and get auto-redirected to http://www.YourDomain.com/.
If the forward works, but your page does not open successfully, then verify you can hit the “yourdomain.azurewebsites.net” url without error. If it works at that domain, and it forwards, but not at the www subdomain then check that your code does not have any conditional logic based on the domain portion of the url, such as may be the case with a Content Management System.