Configure a custom domain name in Azure App Service
When you create a web app, Azure assigns it to a subdomain of azurewebsites.net. For example, if your web app is named contoso, the URL is contoso.azurewebsites.net. Azure also assigns a virtual IP address.
For a production web app, you may want users to see a custom domain name. This article explains how to configure a custom domain with App Service Web Apps.
If you need more help at any point in this article, you can contact the Azure experts on the MSDN Azure and the Stack Overflow forums. Alternatively, you can also file an Azure support incident. Go to the Azure Support site and click on Get Support.
This article is for App Service (Web Apps, API Apps, Mobile Apps, Logic Apps); for Cloud Services, see Configuring a Custom Domain Name in Azure.
For instructions on using Traffic Manager to load balance traffic to a web app, use the selector at the top of this article to select the Traffic Manager specific steps.
Custom domain names cannot be used with Free web app. You must configure your web app for Shared, Basic, or Standard mode, which may change how much you are billed for your subscription. See Web Apps Pricing Details for more information.
If you haven't already registered for an external domain name (i.e. not *.azurewebsites.net) already, the easiest way to set up a custom domain is to buy one directly in the Azure Portal. The process enables you to manage your web app's domain name directly in the Portal instead of going to a third-party site like GoDaddy to manage it. Likewise, configuring the domain name in your web app is greatly simplified, whether your web app uses Azure Traffic Manager or not. For more information, see Buy and Configure a custom domain name in Azure App Service.
If you have a domain name already, or you want reserve domain from other domain registrars, here are the general steps to bring a custom domain name for web app (see specific instructions for GoDaddy.com):
- 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 web app.
- Add the domain name inside the Azure 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 web apps.
- 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 Web Apps. Before switching a web app from the Free mode to the Shared, Basic or Standard mode, you must first remove spending caps in place for your Web Apps subscription.
For more information on the App Service plan modes, including how to change the mode of your site, see How to scale web apps.
The Domain Name System (DNS) uses data records to map domain names into IP addresses. There are several types of DNS records. For web apps, 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 <yourwebapp>.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 web app, or change the web app mode back to free.
Skip this step if you are creating a CNAME record. To create an A record, you need the virtual IP address of your web app. To get the IP address:
- In your browser, open the Azure Portal.
- Click the Browse option on the left side of the page.
- Click the Web Apps blade.
- Click the name of your web app.
- In the Essentials page, click All settings.
- Click Custom domains and SSL.
- In the Custom domains and SSL blade, click Bring External Domains". The IP address is located at the bottom of this part.
Log in to your domain registrar and use their tool to add an A record or CNAME record. Every registrar’s web app 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:
|Host||Record type||IP Address or URL|
Assuming the custom domain name is ‘contoso.com’, this would create the following records:
- contoso.com mapped to 188.8.131.52.
- www.contoso.com mapped to contoso.azurewebsites.net.
You can use Azure DNS to host the necessary domain records for your web app. To configure your custom domain, and create your records, in Azure DNS, see Create custom DNS records for a web app.
If you create an A record, web app 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.<yourwebappname>.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.<yourwebappname>.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 web app will not see the awverify subdomain; it’s only for Azure to verify your domain.
After the records for your domain name have propagated, you must associate them with your Web App. 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 web app until the CNAME has propagated. If you are using an A record, you cannot add the A record domain name to your web app 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 Portal.
In the Web Apps tab, click the name of your web app, select Settings, and then select Custom domains and SSL
In the Custom domains and SSL blade, click Bring external domains.
Use the DOMAIN NAMES text boxes to enter the domain names to associate with this web app.
Click Save to save the domain name configuration.
Once configuration has completed, the custom domain name will be listed in the domain names section of your web app.
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 web app.
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
After you finish the configuration steps, it can take some time for the changes to propagate, depending on your DNS provider. You can verify that the DNS propagation is working as expected by using http://digwebinterface.com/. After you browse to the site, specify the hostnames in the textbox and click Dig. Verify the results to confirm if the recent changes have taken effect.
The propagation of the DNS entries takes up to 48 hours (sometimes longer). If you have configured everything correctly, you still need to wait for the propagation to succeed.
- For a guide to the change from Websites to App Service see: Azure App Service and Its Impact on Existing Azure Services