Using Azure Traffic Manager with Azure Web Sites

Editor’s note: Many thanks to the Azure Web Sites product team for contributing to and reviewing the content in this post.

Azure Traffic Manager (ATM) is a DNS-based service for managing traffic to Azure services, and it’s recently been made available to Web Sites users. You can use ATM to:

  • Route visitors to your site to a region that will provide the best performance.
  • Automatically route traffic to a secondary region if there is a problem in the primary region where your site is hosted.
  • Spread load evenly across multiple copies of your website hosted in multiple regions.

In this post, I’ll walk you through how you can configure ATM to work with Web Sites.

Create Your Sites

In order to use ATM with Web Sites, you will need to have two or more sites and each of them must be running in a different region. You can only add one website per region to ATM, so this requirement is important.

In the screenshot below, you can see that I’ve created two sites, one in East US and one in Japan West. Both of these sites are running in Standard mode. (You must run your sites in Standard mode or Basic mode in order to use ATM with Web Sites.)

WAWS Sites

Create Your ATM Profile

ATM will route traffic based on a profile that you create. You can create a ATM profile from the Azure portal. ATM is available as a node on the left side of the portal.

Traffic Manager

In the screenshot below, I am creating a new Traffic Manager profile. I have chosen “cheshire” as my DNS prefix and you can see that my ATM URL will be

Creating a WATM Profile

I’ve selected Performance for my load balancing method. I can change the load balancing after I’ve created my ATM profile in case my needs change after I create the profile. (For details on the different load balancing methods, see Load Balancing Methods later in this blog post.)

Adding Endpoints

Once you’ve created your ATM profile, you’ll want to add your endpoints. You can do that by clicking on the ATM profile and then clicking the Endpoints link at the top of the portal. As you can see in the screenshot below, I’ve selected Web Site as the service type and then checked each of the websites I want included in my ATM profile.

Adding Endpoints

It’s important to note that your endpoints can be a mix of websites and cloud services. Using this method, you can have your application seamlessly transition from Web Sites to a Web Role or vice versa.

Configuring Your ATM Profile

If you click the Configure link for your ATM profile in the portal, you can configure the settings for the ATM profile. You can change settings such as the DNS time to live and the load balancing method. You can also specify the protocol, port and path that you want the ATM profile to use when monitoring your endpoint for availability.

Configuring a WATM Profile

One important note at this point. ATM will use the path in the Monitoring Settings section to check the endpoints you configured. It performs that check once every 30 seconds, and only an HTTP 200 status is considered healthy. Therefore, if your application is designed in a way that causes a non-200 response to the root of the site (e.g. an ASP.NET forms authentication site that might return a 302 redirect to the login page), you’ll want to configure a path and file name for your ATM profile that points to an unprotected file so that a 200 response is returned.

Testing Things So Far

You now have a ATM profile that points to your sites running on Azure Web Sites. If you browse to the ATM URL ( in my case), you will hit your Azure Web Sites site. The specific site that your request is routed to depends on the load balancing method that you have configured for your ATM profile.

Web Sites knows how to route the ATM URL to your site because it adds your ATM URL to the custom domains for your site automatically. In the screenshot below, you can see that my ATM URL is listed as a custom domain in my Azure Web Sites site. This was added automatically when I added the site as an endpoint in my ATM profile.

WATM URL in Domain Names

You can see your ATM profile in action using any tool that does a DNS lookup. In my test, I have configured ATM so that users will be automatically directed to the website with the best performance. I can use nslookup to see how that works. Below is a DNS lookup from a client that is in the United States. Notice that the yellow text shows that ATM returned a DNS location of my website located in the East US data center.

DNS Lookup from Central US

Here’s the same DNS lookup, but this time, it’s on a VM that’s running in the Southeast Asia Azure data center. Notice that the yellow text shows that a client in Asia is directed to the site that’s running in the Japan West region.

DNS Lookup from Southeast Asia

This test illustrates the DNS-based nature of ATM.

Using a Custom Domain

You’ll likely want to use a custom domain name for your websites. This is quite easy to do when using ATM. You will first need to create a www CNAME entry at your domain registrar that points to your ATM URL. You’ll then simply add your custom domain name to the Azure Web Sites site.

In the screenshot below, you can see that I’ve created a www CNAME record at my domain registrar that points to my ATM URL,


Note: Your subdomain may not be “www”. In that case, create a CNAME record for the subdomain you want to use. For example, you might want to use In that case, you’d create a “blog” CNAME record that points to your ATM URL.

Once this change propagates, it will result in a 404 error page until I add my domain name to all of the sites that are configured as endpoints in ATM. I can use the Manage Domains dialog accessible from the Configure page for my site to do that. Notice here that I’ve added my custom domain to my site.

Adding a Custom Domain to WAWS

If you’re already familiar with the process used for adding a custom domain to a site in Azure Web Sites, it’s important to understand that the typical steps aren’t relevant when configuring a custom domain for use with ATM. You do not have to (and should not) perform any steps other than adding the domain name as I have in the screenshot above.

Note: ATM is CNAME based and doesn’t support A records. Therefore, you can’t use a naked domain ( with ATM. It requires that you set up a CNAME record.

Load Balancing Methods

As I said before, you can change the load balancing method your ATM profile uses whenever you choose. Here are the options that are available on the Configure page in the portal for your WATM profile.

  • Performance – When this method is used, ATM will send users to the region where he or she will get the best performance. This prevents situations where, for example, a user who is in the Central US region is directed to a site running in West Europe.
  • Failover – This method will redirect traffic to a secondary region if there is a problem in the primary region. For example, you may have a site in a “backup” region that doesn’t handle any traffic unless your primary site is offline for some reason.
  • Round Robin – This method will evenly distribute traffic across the endpoints configured in your ATM profile using a round robin load balancing methodology. You can use this method, for example, to “ramp up” traffic to a particular endpoint without allowing it to receive all of your traffic immediately. (In the future, ATM will include enhanced functionality to make this kind of scenario even easier to configure.)

More Information

Kevin Williamson, a senior escalation engineer at Microsoft, has posted a couple of blog posts specific to ATM that may help you if you run into problems.

Windows Azure Traffic Manager Degraded Status

Windows Azure Traffic Manager Performance Impact


Traffic Manager is a feature that Web Sites customers have been looking forward to for quite some time. I hope this post helps you to take advantage of this powerful new functionality. If you have any questions, please comment!