Configuring a custom domain name for a web app in Azure App Service using Traffic Manager
When you use a Microsoft Azure Traffic Manager to load balance traffic to your Azure Website, that website can then be accessed using the *.trafficmanager.net domain name assigned by Azure. You can also associate a custom domain name, such as www.contoso.com, with your website in order to provide a more recognizable domain name for your users.
If you do not already have a Traffic Manager profile, use the information in Create a Traffic Manager profile using Quick Create to create one. Note the .trafficmanager.net domain name associated with your Traffic Manager profile, as this will be used later by later steps in this document.
This article is for Azure App Service (Web Apps, API Apps, Mobile Apps, Logic Apps); for Cloud Services, see Configuring a custom domain name for an Azure cloud service.
If your app is load-balanced by Azure Traffic Manager, click the selector at the top of this article to get specific steps.
Custom domain names are not enabled for Free tier. You must scale up to a higher pricing tier, which may change how much you are billed for your subscription. See App Service Pricing for more information.
Understanding DNS records
The Domain Name System (DNS) is used to locate things on the internet. For example, when you enter an address in your browser, or click a link on a web page, it uses DNS to translate the domain into an IP address. The IP address is sort of like a street address, but it's not very human friendly. For example, it is much easier to remember a DNS name like contoso.com than it is to remember an IP address such as 192.168.1.88 or 2001:0:4137:1f67:24a2:3888:9cce:fea3.
The DNS system is based on records. Records associate a specific name, such as contoso.com, with either an IP address or another DNS name. When an application, such as a web browser, looks up a name in DNS, it finds the record, and uses whatever it points to as the address. If the value it points to is an IP address, the browser will use that value. If it points to another DNS name, then the application has to do resolution again. Ultimately, all name resolution will end in an IP address.
When you create an Azure Website, a DNS name is automatically assigned to the site. This name takes the form of <yoursitename>.azurewebsites.net. When you add your website as an Azure Traffic Manager endpoint, your website is then accessible through the <yourtrafficmanagerprofile>.trafficmanager.net domain.
When your website is configured as a Traffic Manager endpoint, you will use the .trafficmanager.net address when creating DNS records.
You can only use CNAME records with Traffic Manager
There are also multiple types of records, each with their own functions and limitations, but for websites configured to as Traffic Manager endpoints, we only care about one; CNAME records.
CNAME or Alias record
A CNAME record maps a specific DNS name, such as mail.contoso.com or www.contoso.com, to another (canonical) domain name. In the case of Azure Websites using Traffic Manager, the canonical domain name is the <myapp>.trafficmanager.net domain name of your Traffic Manager profile. Once created, the CNAME creates an alias for the <myapp>.trafficmanager.net domain name. The CNAME entry will resolve to the IP address of your <myapp>.trafficmanager.net domain name automatically, so if the IP address of the website changes, you do not have to take any action.
Once traffic arrives at Traffic Manager, it then routes the traffic to your website, using the load balancing method it is configured for. This is completely transparent to visitors to your website. They will only see the custom domain name in their browser.
Some domain registrars only allow you to map subdomains when using a CNAME record, such as www.contoso.com, and not root names, such as contoso.com. For more information on CNAME records, see the documentation provided by your registrar, the Wikipedia entry on CNAME record, or the IETF Domain Names - Implementation and Specification document.
Configure your web apps for standard mode
Setting a custom domain name on a web app that is integrated with Traffic Manager is only available for the Standard pricing tier.
For more information on the App Service pricing tiers, including how to change your app's pricing tier, see Scale up an app in Azure.
Add a DNS record for your custom domain
If you have purchased domain through Azure App Service Web Apps then skip following steps and refer to the final step of Buy Domain for Web Apps article.
To associate your custom domain with a web app in Azure App Service, you must add a new entry in the DNS table for your custom domain. You do this by using the management tools from your domain provider.
You can use Azure DNS to configure a custom DNS name for your Azure Web Apps. For more information, see Use Azure DNS to provide custom domain settings for an Azure service.
Sign in to the website of your domain provider.
Find the page for managing DNS records. Every domain provider has its own DNS records interface, so consult the provider's documentation. Look for areas of the site labeled Domain Name, DNS, or Name Server Management.
Often, you can find the DNS records page by viewing your account information, and then looking for a link such as My domains. Go to that page and then look for a link that is named something like Zone file, DNS Records, or Advanced configuration.
The following screenshot is an example of a DNS records page:
In the example screenshot, you select Add to create a record. Some providers have different links to add different record types. Again, consult the provider's documentation.
For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save Changes link.
While the specifics of each domain provider vary, you map from your custom domain name (such as contoso.com) to the Traffic Manager domain name (contoso.trafficmanager.net) that is integrated with your web app.
If a record is already in use and you need to preemptively bind your apps to it, you can create an additional CNAME record. For example, to preemptively bind www.contoso.com to your web app, create a CNAME record from awverify.www to contoso.trafficmanager.net. You can then add "www.contoso.com" to your Web App without changing the "www" CNAME record. For more information, see Create DNS records for a web app in a custom domain.
Once you have finished adding or modifying DNS records at your domain provider, save the changes.
Enable Traffic Manager
After the records for your domain name have propagated, you should be able to use your browser to verify that your custom domain name can be used to access your web app in Azure App Service.
It can take some time for your CNAME to propagate through the DNS system. You can use a service such as https://www.digwebinterface.com/ to verify that the CNAME is available.
If you have not already added your web app as a Traffic Manager endpoint, you must do this before name resolution will work, as the custom domain name routes to Traffic Manager. Traffic Manager then routes to your web app. Use the information in Add or Delete Endpoints to add your web app as an endpoint in your Traffic Manager profile.
If your web app is not listed when adding an endpoint, verify that it is configured for Standard App Service plan mode. You must use Standard mode for your web app in order to work with Traffic Manager.
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
In the Custom domains blade, click Add hostname.
Use the Hostname text boxes to enter the Traffic Manager domain name to associate with this web app.
Click Validate to save the domain name configuration.
Upon clicking Validate Azure will kick off Domain Verification workflow. This will check for Domain ownership as well as Hostname availability and report success or detailed error with prescriptive guidance on how to fix the error.
Upon successful validation Add hostname button will become active and you will be able to the assign hostname. Now navigate to your custom domain name in a browser. You should now see your app running using your custom domain name.
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 Traffic Manager domain name in your browser and see that it successfully takes you to your web app.
For more information, see the Node.js Developer Center.
Send feedback about: