Get going faster--use the NEW Azure guided walkthrough! It makes associating a custom domain name AND securing communication (SSL) with Azure Cloud Services or Azure Websites a snap.
When you create a website, Azure assigns it to a subdomain of azurewebsites.net. For example, if your website is named contoso, the URL is contoso.azurewebsites.net. Azure also assigns a virtual IP address.
For a production website, you probably want users to see a custom domain name. This article explains how to configure a custom domain with Azure Websites. (This article provides generic instructions for any domain registrar. The tabs at the top of this article link to some articles for specific registrars.)
This article is for Azure Websites; for Cloud Services, see Configuring a Custom Domain Name in Azure.
For instructions on using Traffic Manager to load balance traffic to websites, use the selector at the top of this article to select the Traffic Manager specific steps.
Custom domain names cannot be used with Free websites. You must configure your websites for Shared, Basic, or Standard mode, which may change how much you are billed for your subscription. See Websites Pricing Details for more information.
In this article:
Here are the general steps to configure a custom domain name:
- Reserve your domain name. This article does not cover that process. There are many domain registrars to choose from. When you sign up, their site will walk you through the process.
- Create DNS records that map the domain to your Azure website.
- Add the domain name inside the Azure Management Portal.
Within this basic outline, there are specific cases to consider:
- Mapping your root domain. The root domain is the domain that you reserved with the domain registrar. For example, contoso.com.
- Mapping a subdomain. For example, blogs.contoso.com. You can map different subdomains to different websites.
- Mapping a wildcard. For example, *.contoso.com. A wildcard entry applies to all subdomains of your domain.
Setting a custom domain name is only available for the Shared, Basic and Standard modes for Azure Websites. Before switching a website from the Free website mode to the Shared, Basic or Standard mode, you must first remove spending caps in place for your Website subscription.
For more information on the Website modes, including how to change the mode of your site, see How to scale web sites.
DNS record types
The Domain Name System (DNS) uses data records to map domain names into IP addresses. There are several types of DNS records. For websites, you’ll create either an A record or a CNAME record.
- An A (Address) record maps a domain name to an IP address.
- A CNAME (Canonical Name) record maps a domain name to another domain name. DNS uses the second name to look up the address. Users still see the first domain name in their browser. For example, you could map contoso.com to <yoursite>.azurewebsites.net.
If the IP address changes, a CNAME entry is still valid, whereas an A record must be updated. However, some domain registrars do not allow CNAME records for the root domain or for wildcard domains. In that case, you must use an A record.
The IP address may change if you delete and recreate your website, or change the website mode back to free.
Find the virtual IP address
Skip this step if you are creating a CNAME record. To create an A record, you need the virtual IP address of your website. To get the IP address:
- In your browser, open the Azure Management Portal.
- In the Websites tab, click the name of your site and select Dashboard.
Select Manage Domains from the bottom of the page. (If this option is disabled, make sure you are using Shared, Basic, or Standard mode. For more information, see How to scale websites.)
The IP address is listed toward the bottom of the dialog.
Create the DNS records
Log in to your domain registrar and use their tool to add an A record or CNAME record. Every registrar’s website is slightly different, but here are some general guidelines.
- Find the page for managing DNS records. Look for links or areas of the site labeled Domain Name, DNS, or Name Server Management. Often the link can be found be viewing your account information, and then looking for a link such as My domains.
- When you find the management page, look for a link that lets you add or edit DNS records. This might be listed as a Zone file, DNS Records, or as an Advanced configuration link.
The page might list A records and CNAME records separately, or else provide a drop-down to select the record type. Also, it might use other names for the record types, such as IP Address record instead of A record, or Alias Record instead of CNAME record. Usually the registrar creates some records for you, so there may already be records for the root domain or common subdomains, such as www.
When you create or edit a record, the fields will let you map your domain name to an IP address (for A records) or another domain (for CNAME records). For a CNAME record, you will map from your custom domain to your azurewebsites.net subdomain.
In many registrar tools, you will just type the subdomain portion of your domain, not the entire domain name. Also, many tools use ‘@’ to mean the root domain. For example:
||IP Address or URL
Assuming the custom domain name is ‘contoso.com’, this would create the following records:
- contoso.com mapped to 127.0.0.1.
- www.contoso.com mapped to contoso.azurewebsites.net.
Create an “awverify” record (A records only)
If you create an A record, Azure websites also requires a special CNAME record, which is used to verify that you own the domain you are attempting to use. This CNAME record must have the following form.
- If the A record maps the root domain or a wildcard domain: Create a CNAME record that maps from awverify.<yourdomain> to awverify.<yourwebsitename>.azurewebsites.net. For example, if the A record is for contoso.com, create a CNAME record for awverify.contoso.com.
- If the A record maps a specific subdomain: Create a CNAME record that maps from awverify.<subdomain> to awverify.<yourwebsitename>.azurewebsites.net. For example, if the A record is for blogs.contoso.com, create a CNAME record for awverify.blogs.contoso.com.
Visitors to your site will not see the awverify subdomain; it’s only for Azure to verify your domain.
Enable the domain name on your website
After the records for your domain name have propagated, you must associate them with your website. Use the following steps to enable the domain names using your web browser.
It can take some time for CNAME records created in the previous steps to propagate through the DNS system. You cannot add the domain name of to your Azure Website until the CNAME has propagated. If you are using an A record, you cannot add the A record domain name to your Azure Website until the awverify CNAME record created in the previous step has propagated.
You can use a service such as http://www.digwebinterface.com/ to verify that the CNAME is available.
In your browser, open the Azure Management Portal.
In the Websites tab, click the name of your site, select Dashboard, and then select Manage Domains from the bottom of the page.
Use the DOMAIN NAMES text boxes to enter the domain names to associate with this website.
Click the check mark in the lower right corner to save the domain name configuration.
Once configuration has completed, the custom domain name will be listed in the domain names section of the Configure page of your website.
At this point, you should be able to enter the custom domain name in your browser and see that it successfully takes you to your Azure Website.