Azure Traffic Manager – Failover with custom domain

azuredomain-name-system

I'm trying to do what I think should be pretty simple, but I'm missing something. Can you take a look?

I'm in the Azure Cloud, running two web apps in different service plans, in different regions. The two apps are copies of each other.

I'm trying to use Azure Traffic Manager to fail-over from the primary region to the secondary region if the primary region goes down.

I want to be able to use the same domain name, even when the site fails over. Here is what I have so far:

Domain name is 'example.com'

  1. Set up traffic manager profile, monitoring both endpoints. Check.
  2. Set up a CNAME DNS records for wwww.example.com pointing to exampledotcom.trafficmanager.net. Check.
  3. Browse to exampledotcom.trafficmanager.net and I get routed as expected. Check.
  4. If I connect to www.example.com, Traffic Manager seems to route me to an instance, but I get the following Azure Error:

"Error 404 – Web app not found. The web app you have attempted to
reach is not available in this Microsoft Azure App Service region."

This is happening because I don't have the domain name mapped to the Azure Web App. When I attempt to map the custom domain to two instances, in different regions (for fail-over purposes), Azure complains that the domain is already registered to another web app.

How can I map a custom domain to two Web Apps for fail-over purposes with Traffic Manager?

Best Answer

I spoke with Azure support. You can, in fact, bind the same domain name to two different WebApps in this scenario, provided that:

  1. They are different regions
  2. You target them with TrafficManager endpoint first.

If you don't bind the custom domain to both WebApps, you will not be able to access your site after fail-over. The WebApp will refuse the traffic if the domain name is not bound.

This is what I was told and what ended up working:

  1. Create Traffic Manager profiles and add both WebApps as end points. This will bind XXXX.trafficmanager.net domains to each Web App.

  2. WAIT for the domains to propagate through the Azure system and show up in the "Custom Domains" menu of the WebApps.

  3. Go to bind a custom domain name as usual, but make sure you select the XXXX.trafficmanager.net address as shown in the photo:

enter image description here

Related Topic