10 Easy Steps to Azure Web Site Custom Domains

If you want to add a custom domain name to an Azure Web Site, you are just a few steps away.  This quick tutorial will show you how to configure both your DNS zone, as well as your Azure Web Site. I did make a few assumptions though…

Assumptions:

  1. You have already registered your custom domain with a registrar, and have a DNS provider.  I usually use GoDaddy for this, but there are numerous other choices. Use whichever one you prefer.
  2. Since I usually use GoDaddy as my DNS provider, I will show the steps specific to their tools.  However, you should be able to complete the exact same steps with your own DNS provider’s administration pages
  3. I assume you already have a valid Windows Azure account, and a web site configured.
  4. All of my domain name references assume a “.com” top level domain.  You can use any top level domain name you wish though (“.net”, “.org”, “.us”, etc.)

Ok. let ‘s get started:



1 – Set the Web Site to “SHARED” or “RESERVED”

In the Azure Management Portal, on your web site’s “SCALE” page, pick the “SHARED”  or “RESERVED” WEB SITE MODE (make sure to read about, and accept the pricing).  You can’t do custom domains with the “FREE” mode.

Step1


2 – Open the “manage domains” window

In the Azure Management Portal, on your web site’s “CONFIGURE” page, click the “manage domains” button.

SNAGHTML5a70d65


3 – Open your DNS Zone Editor

In a separate browser window, open your DNS provider’s zone management page.  I’m using GoDaddy, but you can use whichever DNS provider you like.  Opening the zone editor in a separate window is helpful so you can see both your DNS zone file, and your Azure Web Site configurations at the same time.

Note: In the following exercises you will be changing your DNS “A” (host) and “CNAME” (alias, or Canonical Name) records.  If you are new to DNS, don’t worry, you don’t have to be a DNS expert to do this.  However, if you would like to learn more you can read up about it.  Here’s a link to the Wikipedia page on the Domain Name System as well as a List of DNS record types.

A (“host”) records map a host name, like “www” to an IP address.  They are used to represent “hosts” (think computers) on the internet.  Each host on the internet has a unique IP address.

The “@” A record is a special record that sets the IP address for the domain name itself.  For example, if you were to enter http://w8appfactor.com (without the “www”) into the address bar of your browser, it is the “@” record that would be used to provide the IP address.

CNAME (“alias”, or Canonical Name) records map a host name, like “www’” to another name. For example below we will map the “www” CNAME record to the “@” A record.  They are basically a way to have an alternate host name for a given IP address.

SNAGHTML5a9de4a


4 – Point your DNS “@” Record IP to the Web Site

Edit your DNS “@” A record’s IP address to match the IP address for your web site shown in the “Manage custom domains” window.  This will allow any references to the domain itself (yourdomainname.com) point to the website.

Note, when you are editing your DNS zone file A and CNAME records, set the TTL (Time To Live) values as LOW as possible.  This will cause them to expire from other downstream DNS caches quicker.  This is handy if you need to make changes again.  Shorter TTLs mean you don’t have to wait as long for older invalid entries to be cleared from downstream DNS server and client caches.  Once you have verified that everything is working properly, you can come back and increase the TTLs if you need to reduce the load on your DNS server. 

SNAGHTML5b40ecc


5 – Point your “WWW” CNAME to your “@” A Record

Ensure that the domain has a “www” CNAME record that points to the domain’s “@” A record.  This will make sure that “www.yourdomainname.com” points to the same IP address as the domain itself.

Note: If you have a “www” host (A) record instead you can either point it to the same IP address as the “@” record above, or (and this is what I recommend) delete your “www” host (A) record, and create a new “www” alias (CNAME) record that points to the “@” host record.  The end result is that we want the “www” and “@” records to point to the same IP.  The “www” CNAME –> “@” A record is the safest way because if you have to edit the IP address later, you only have to edit it once by changing the “@” record.

SNAGHTML5b8e07c


6 – Add the “awverify” and “awverify.www” CNAMEs

Add the following two “awverify” CNAME records to your DNS zone file.  Make sure to replace “yourwebsitename” with your actual web site name.  These records are used by the Windows Azure Management Portal to ensure that you have the ability to use the custom domain you are trying to assign.  By verifying that these records are in place, they know that you must have had administrative access to the DNS zone file to put them there.  These records are used solely for verification purposes:

CNAME Host Name CNAME Points To Example
awverify awverify.yourwebsitename.azurewebsites.net awverify.w8appfactor.azurewebsites.net
awverify.www awverify.yourwebsitename.azurewebsites.net awverify.w8appfactor.azurewebsites.net

SNAGHTML5c04cc6[6]


7 – Save your DNS Zone File Changes

In your DNS provider’s zone editor, save your changes

SNAGHTML5c4d891


8 – Add “yourdomainname.com” to the Web Site

In the Azure “Manage custom domains” window, enter your custom domain name “yourdomainname.com” (without the “www”).   For example, w8appfactor.com. The Azure Management Portal will verify the “awverify” CNAME record we added above, and if it looks good, you should see a green circle with a white checkmark in it appear (image).  Once the record is verified.  Click the checkmark button to the right of the record to accept it (image ).

SNAGHTML5c8beab


9 – Add “www.yourdomainname.com” to the website.

Repeat the steps above, but this time for www.yourdomainname.com (include the “www” this time). For example, www.w8appfactor.com. This time the Azure management portal will verify the existence of the “awverify.www” CNAME record we created earlier and show the green circle (image) when the verification succeeds. Click the checkmark button (image ) to accept the entry, then click the big check mark button in the lower right corner ( image  ) to close the “Manage custom domains” popup.

SNAGHTML5d1d48b


10 – Test it out!

Open your browser and test out both the “yourdomainname.com” and “www.yourdomainname.com” URLs.  They should both work.

image


Troubleshooting Tips

If your custom domain isn’t working:

  1. Verify all that of the steps above have been completed, and without typos.  I promise, 99.9% of the times I’ve helped people resolve issues around this, it has been that they typed something in wrong somewhere.  The back-end systems work. You just have to give them the right info.
  2. On your client machine, clear your DNS cache by
    1. Opening an administrative command prompt
    2. Issue the following command: “ipconfig /flushdns
  3. If you did have to edit the zone file again, wait for the “TTL” (Time To Live) for your records to expire. For example, in my screenshots above, I set all of the records TTLs to as low a value as possible. GoDaddy only let me set them as low as 1/2 hour, or 30 minutes.  If your DNS zone file lets you go lower, great.  That will help during the debug phase.  The TTL controls how long the name should be cached by other DNS servers.  Shorter TTLs allow you wait a shorter period of time for your DNS servers to clear their cache of the old invalid entries.
  4. Close all of your browser instances and try again. 

5 Responses

Leave a Reply