Overview and What You Will Learn
Azure Traffic Manager routes users at the DNS level by answering a lookup with the address of a healthy regional endpoint, while Azure Front Door is an application-layer proxy that receives and forwards every HTTP request. In this lab, you will deploy the same app in two regions, put Traffic Manager in front and watch DNS failover happen, then put Front Door in front of the same apps and see that real HTTP traffic now flows through it.
Why This Matters in Production
Picking the wrong global router leaves a hole in your design that only shows up in production. Imagine a team at a streaming company like Netflix running an app in two Azure regions for resilience. They configure Traffic Manager and expect it to cache static content and block web attacks. It cannot do either, because it only answers DNS questions and never sees the HTTP traffic that follows. Front Door was the right tool for that requirement.
Core Principles
Both services send users to the best healthy region, but at different layers. Traffic Manager answers a DNS query and then steps out of the picture, so the client connects straight to the endpoint.
Front Door stays in the path of every request, so it can cache, filter, and retry.
| Capability | Traffic Manager | Front Door |
|---|---|---|
| Layer and protocols | DNS, any protocol or endpoint | HTTP and HTTPS only |
| Caching and WAF | Neither | Both |
| Failover mechanism | Health probes plus DNS TTL | Health probes plus request retry |
RememberTraffic Manager failover is only as fast as client DNS caches allow. A resolver that cached the old answer keeps sending users to the failed endpoint until the TTL expires.
Detailed Step-by-Step Practical Lab
This lab creates billable resources, including two App Service plans and a Front Door profile that charge by the hour. Delete everything when you finish.
How to Create Two Regional Web Apps
Traffic Manager needs real endpoints to health-check, so deploy one default web app in each region. App Service names are globally unique, so change the suffix if yours is taken. If the runtime is rejected, run az webapp list-runtimes --os-type linux and pick a current one.
export RG="rg-traffic-lab-mumbai"export APP_IN="app-india-rahul-2026"export APP_EU="app-europe-rahul-2026" az group create --name $RG --location centralindia az appservice plan create \ --resource-group $RG --name plan-india \ --location centralindia --sku B1 --is-linux az webapp create \ --resource-group $RG --plan plan-india \ --name $APP_IN --runtime "NODE:22-lts" az appservice plan create \ --resource-group $RG --name plan-europe \ --location westeurope --sku B1 --is-linux az webapp create \ --resource-group $RG --plan plan-europe \ --name $APP_EU --runtime "NODE:22-lts" curl -s -i https://$APP_IN.azurewebsites.net | head -n 1curl -s -i https://$APP_EU.azurewebsites.net | head -n 1How to Create a Traffic Manager Profile
Performance routing sends each user to the endpoint with the lowest network latency. The DNS name must be unique across trafficmanager.net, and a short TTL of 30 seconds makes failover easy to observe.
az network traffic-manager profile create \ --resource-group $RG \ --name tm-lab-profile \ --routing-method Performance \ --unique-dns-name tmlabrahul2026 \ --ttl 30 \ --monitor-protocol Http \ --monitor-port 80 \ --monitor-path /How to Add Regional Endpoints to Traffic Manager
External endpoints need a location, which Performance routing uses to estimate latency.
az network traffic-manager endpoint create \ --resource-group $RG \ --profile-name tm-lab-profile \ --name endpoint-india \ --type externalEndpoints \ --target "$APP_IN.azurewebsites.net" \ --endpoint-location "Central India" az network traffic-manager endpoint create \ --resource-group $RG \ --profile-name tm-lab-profile \ --name endpoint-europe \ --type externalEndpoints \ --target "$APP_EU.azurewebsites.net" \ --endpoint-location "West Europe"How to Check Endpoint Health and the DNS Answer
Wait a minute for the first probes. Both endpoints should report Online, and the DNS answer is only a name and an address, never any HTTP content.
az network traffic-manager endpoint list \ --resource-group $RG \ --profile-name tm-lab-profile \ --query "[].[name, endpointMonitorStatus]" \ --output table dig +short tmlabrahul2026.trafficmanager.netThe endpoint returned depends on where the DNS query comes from, so it is usually the one nearest to your Cloud Shell region.
TipTraffic Manager measures latency from the DNS resolver's location, not from the user. A user on a distant corporate resolver can be routed as if they were sitting next to it.
How to Test DNS Failover
Disable whichever endpoint the DNS answer pointed to, wait longer than the 30-second TTL, and query again. The answer switches to the other region, but only because the cached record expired.
ANSWER=$(dig +short CNAME tmlabrahul2026.trafficmanager.net | head -n 1)echo "Current answer: $ANSWER" if echo "$ANSWER" | grep -q "$APP_IN"; then FIRST=endpoint-india; else FIRST=endpoint-europe; fi az network traffic-manager endpoint update \ --resource-group $RG \ --profile-name tm-lab-profile \ --name $FIRST \ --type externalEndpoints \ --endpoint-status Disabled sleep 45dig +short CNAME tmlabrahul2026.trafficmanager.net | head -n 1How to Create an Azure Front Door Profile
Front Door Standard is built from a profile, an endpoint, an origin group with a health probe, the origins themselves, and a route that ties them together. Deployment changes can take several minutes to reach every edge location.
az afd profile create \ --resource-group $RG \ --profile-name fd-lab-profile \ --sku Standard_AzureFrontDoor az afd endpoint create \ --resource-group $RG \ --profile-name fd-lab-profile \ --endpoint-name fd-lab-rahul-2026 \ --enabled-state Enabled az afd origin-group create \ --resource-group $RG \ --profile-name fd-lab-profile \ --origin-group-name og-apps \ --probe-request-type GET \ --probe-protocol Http \ --probe-interval-in-seconds 30 \ --probe-path / \ --sample-size 4 \ --successful-samples-required 3 \ --additional-latency-in-milliseconds 50How to Add the Same Apps as Front Door Origins
Each origin sends its own host name as the host header, so the web app accepts the request.
az afd origin create \ --resource-group $RG \ --profile-name fd-lab-profile \ --origin-group-name og-apps \ --origin-name origin-india \ --host-name $APP_IN.azurewebsites.net \ --origin-host-header $APP_IN.azurewebsites.net \ --priority 1 --weight 1000 \ --enabled-state Enabled \ --http-port 80 --https-port 443 az afd origin create \ --resource-group $RG \ --profile-name fd-lab-profile \ --origin-group-name og-apps \ --origin-name origin-europe \ --host-name $APP_EU.azurewebsites.net \ --origin-host-header $APP_EU.azurewebsites.net \ --priority 1 --weight 1000 \ --enabled-state Enabled \ --http-port 80 --https-port 443 az afd route create \ --resource-group $RG \ --profile-name fd-lab-profile \ --endpoint-name fd-lab-rahul-2026 \ --route-name route-default \ --origin-group og-apps \ --supported-protocols Http Https \ --link-to-default-domain Enabled \ --forwarding-protocol MatchRequestHow to See That Front Door Proxies Real HTTP Traffic
Wait several minutes for the route to propagate, then request the Front Door host name. The response carries a Front Door reference header, proof that the request passed through the proxy.
FD_HOST=$(az afd endpoint show \ --resource-group $RG \ --profile-name fd-lab-profile \ --endpoint-name fd-lab-rahul-2026 \ --query hostName --output tsv) curl -sI https://$FD_HOST/ | grep -i -E "^(HTTP|x-azure-ref)"Compare this with the Traffic Manager step. There you only ever received a DNS answer, while here you received headers from an HTTP response that Front Door handled.
How to Clean Up
az group delete --name $RG --yes --no-waitProduction Best Practices & Common Pitfalls
Common MistakeExpecting Traffic Manager to provide caching or WAF protection. It only answers DNS lookups and has no view of the HTTP request and response that follow.
TipIf the requirement is only "send users to the nearest healthy region," Traffic Manager is the simpler, lower-cost choice. The moment caching or a global WAF becomes a requirement, choose Front Door.
SecurityLock your origins down so they accept traffic only from Front Door, using the
AzureFrontDoor.Backendservice tag and a check on theX-Azure-FDIDheader. Otherwise an attacker can hit the origin directly and bypass your WAF entirely.
- Expect DNS caches to delay Traffic Manager failover. Even after Traffic Manager stops returning a failed endpoint, clients and resolvers keep the old answer until the TTL expires.
- Use Traffic Manager for non-HTTP or non-Azure endpoints. It can route any internet-facing endpoint, including TCP services and endpoints outside Azure, while Front Door handles only HTTP and HTTPS.
- Remember that Traffic Manager clients connect directly. Your backends see the real client IP, whereas behind Front Door they see Front Door's addresses and must read the forwarded headers.
- Use Front Door's request-level retry. Because it sees each request, it can retry a failed request against another origin transparently, which DNS-level routing cannot do.
- Choose the tier for your WAF needs. Front Door Standard supports custom WAF rules, while managed rule sets and bot protection need the Premium tier.
- Use Standard or Premium, not classic. Azure Front Door (classic) is being retired.
Quick Reference & Troubleshooting Commands
| Command | Description |
|---|---|
az network traffic-manager profile create |
Create a Traffic Manager profile |
az network traffic-manager endpoint create |
Add a regional endpoint to a profile |
az network traffic-manager endpoint list |
Check endpoint health status |
dig +short NAME.trafficmanager.net |
See which endpoint DNS currently returns |
az afd profile create |
Create an Azure Front Door profile |
az afd origin-group create |
Define origins and their health probe |