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.
You are correct that you need an A record and a CNAME. I have a CNAME pointing www to nexul.azurewebsites.net. I also have the A record the Azure dialog above says to point at.
I will update the article accordingly. Thanks.
This is a great article and exactly what I needed but I’m wondering about the sequence of events. Under Azure Configuration where you talk about managing custom domains, you talk about adding the ” http://www.subdomain that you want pointed at this azure website”
But if I do that and try to save, Azure gives me a validation error:
“The DNS record for ‘www.whatever.com’ that points to ‘whatever.azurewebsites.net’ could not be located. If you want to configure an A record, you must first create a CNAME record with your DNS provider for ‘awverify.www.quizmet.com’ that points to ‘awverify.Quizmet.azurewebsites.net’. First allow the resource record to propagate, and then create the A record.”
I wonder if, when you created this guide, you had already performed the steps for GoDaddy Domain Setup? Or did I do something wrong?
Yes, I had already done this when I wrote the guide. I wrote the guide to answer the question for someone I know that asked me.
I will need to do this again in a few months for a new site. When I do, I will update this guide with anything I have to do differently than the steps outlined here.
Yeah I just created the cname record first and it worked fine.
I’m not really sure that awverify stuff is required, I didn’t do it for this site. I think the long and short of it is, do the dns stuff first, wait for them to propogate and then do the azure part. It was easier than I expected.
Thanks for the guide, it helped a lot.
I think you left out two steps: creating an A record pointing to 168.62.48.183 and creating the CNAME that Azure will use to verify your authority to configure the custom domain name.
Could you add those two steps please?