This chapter covers Azure Traffic Manager routing methods in depth, a critical topic for the AZ-104 exam's networking domain (objective 4.2). About 15–20% of networking questions touch Traffic Manager, focusing on selecting the correct routing method for a given scenario. You will learn the mechanism of each method, when to use it, and how to configure it, including common traps the exam lays. Mastery of these concepts is essential for designing resilient, performant multi-region applications.
Jump to a section
Azure Traffic Manager operates like a GPS navigation system for a delivery fleet. Each endpoint (server) is a destination, and the Traffic Manager profile is the GPS unit that decides which destination to route each delivery request to. The routing method is the navigation strategy: Priority routing is like always sending deliveries to the primary warehouse unless it's closed, then falling back to the secondary. Weighted routing is like splitting deliveries based on each warehouse's capacity—e.g., 80% to the big warehouse, 20% to the small one. Performance routing is like choosing the warehouse closest to the delivery address based on real-time traffic conditions. Geographic routing is like sending deliveries to the warehouse in the correct country or state. The GPS doesn't control the roads (actual network traffic) but provides the destination IP address. The DNS query is the driver asking for directions; Traffic Manager responds with the best endpoint IP. Health checks are like the GPS checking if a warehouse is open before sending a delivery there. If the primary warehouse is closed, the GPS automatically reroutes to the next one. Just as a GPS can be configured to prefer certain routes or avoid tolls, Traffic Manager uses profiles and nested profiles to implement complex routing policies.
What is Azure Traffic Manager and Why Does It Exist?
Azure Traffic Manager is a DNS-based traffic load balancer. It operates at the DNS layer (OSI Layer 7) to distribute incoming DNS requests across multiple endpoints (Azure VMs, cloud services, web apps, or external endpoints) based on a chosen routing method. Unlike Azure Load Balancer (Layer 4) or Application Gateway (Layer 7 with HTTP awareness), Traffic Manager does not terminate traffic or inspect packets. It simply responds to DNS queries with the IP address of the most appropriate endpoint based on the routing method, health of endpoints, and client's DNS resolver location.
Traffic Manager solves several problems: - Global load balancing: Distribute traffic across Azure regions or on-premises data centers. - High availability: Automatically fail over from unhealthy endpoints to healthy ones. - Performance optimization: Route users to the endpoint with the lowest latency. - Geographic compliance: Route users to specific regions based on their location (e.g., EU users to EU data centers for GDPR).
How Traffic Manager Works Internally
When a client makes a DNS query for a domain name (e.g., myapp.trafficmanager.net), the client's DNS resolver sends the query to Azure's authoritative DNS servers. Traffic Manager intercepts this query and, based on the routing method and the health of endpoints, returns a CNAME record pointing to the chosen endpoint's domain name (or directly an IP for external endpoints). The client's browser then resolves that endpoint's IP and connects directly. Traffic Manager does not proxy traffic; it only influences the initial DNS resolution.
Key components: - Traffic Manager profile: Contains the DNS name (e.g., myapp.trafficmanager.net), routing method, endpoints, and health check configuration. - Endpoints: Can be Azure endpoints (cloud services, web apps, VMs), external endpoints (on-premises servers), or nested endpoints (child Traffic Manager profiles). - Health checks: Traffic Manager periodically probes each endpoint using HTTP/HTTPS/TCP on a configurable port and path. Endpoints that fail a configurable number of consecutive probes are marked as degraded and are not returned in DNS responses (unless the routing method has no healthy endpoints, in which case all endpoints are considered).
Routing Methods in Detail
#### Priority Routing - How it works: Assign a numeric priority to each endpoint (1 = highest priority). Traffic Manager returns the highest-priority healthy endpoint. If that endpoint becomes unhealthy, it returns the next priority, and so on. - Use case: Active-passive failover. For example, primary region (priority 1), secondary region (priority 2), tertiary (priority 3). - Default values: Priority must be unique among endpoints. No default priority; you must assign it. If no endpoints are healthy, Traffic Manager returns all endpoints (the client may experience failure). - Exam trap: Candidates often confuse priority with weighted routing. Remember: priority is for failover, not load distribution.
#### Weighted Routing - How it works: Assign a weight (integer from 1 to 1000) to each endpoint. Traffic Manager distributes DNS responses proportionally to the weights. For example, two endpoints with weights 80 and 20 receive 80% and 20% of DNS responses, respectively. The distribution is statistical; real traffic may vary due to DNS caching. - Use case: Load balancing across endpoints with different capacities, or gradual rollout (e.g., 10% traffic to new version). - Default values: If no weight is specified, the default weight is 1. All endpoints with weight 1 get equal traffic. - Exam trap: Weighted routing does NOT guarantee exact traffic split per request; it's probabilistic. Also, weights apply only to healthy endpoints. If an endpoint is unhealthy, its weight is ignored, and remaining healthy endpoints share traffic proportionally.
#### Performance Routing - How it works: Traffic Manager maintains a latency table mapping client DNS resolver IP ranges to Azure regions. When a query arrives, it looks up the client's DNS resolver IP, finds the region with the lowest latency (based on historical measurements), and returns the endpoint in that region (or the endpoint with the lowest measured latency). If multiple endpoints are in the same region, Traffic Manager returns one based on a round-robin or weighted method (if weights are configured). - Use case: Global applications where users should connect to the nearest data center for lowest latency. - Default values: No configuration needed beyond adding endpoints and enabling performance routing. Traffic Manager automatically measures latency between Azure regions and the internet. - Exam trap: Performance routing is based on the DNS resolver's IP, not the end user's IP. Corporate DNS resolvers may be in a different region than the user. Also, latency measurements are between Azure regions and the DNS resolver, not the end user. This can lead to suboptimal routing.
#### Geographic Routing - How it works: Map geographic regions (countries, states, or continents) to specific endpoints. Traffic Manager examines the DNS resolver's IP address to determine the geographic region and returns the endpoint mapped to that region. If no mapping exists, Traffic Manager returns the endpoint configured as the default (if any). - Use case: Compliance with data sovereignty laws (e.g., EU data must stay in EU), or content localization. - Configuration: You must map regions to endpoints explicitly. Regions are defined by ISO country codes or predefined groupings (e.g., North America, Europe). - Exam trap: Geographic routing does NOT consider latency or health beyond basic health checks. If the mapped endpoint is unhealthy, Traffic Manager does NOT fail over to another region; it returns the unhealthy endpoint (or returns nothing if no default is configured). You must use nested profiles to implement failover within a region.
#### Subnet Routing (formerly Multivalue Routing) - How it works: Map IP address ranges (CIDR blocks) to specific endpoints. When a DNS query comes from an IP within a mapped range, Traffic Manager returns the corresponding endpoint. This allows fine-grained control based on client IP. - Use case: Restrict access to certain endpoints for specific IP ranges (e.g., internal corporate network to internal endpoint). - Configuration: Add subnet-to-endpoint mappings. You can also specify a default endpoint for unmapped IPs. - Exam trap: Subnet routing is rarely tested but may appear in scenarios where you need to route specific clients to specific endpoints.
Nested Traffic Manager Profiles
Nested profiles allow combining routing methods. For example, use geographic routing at the top level to send EU users to a child profile that uses performance routing within Europe. The child profile can have multiple endpoints in different European regions. This enables complex, multi-layered routing policies.
Health Check Configuration
Traffic Manager monitors endpoint health using probes. You configure: - Protocol: HTTP, HTTPS, or TCP. - Port: Default 80 for HTTP/HTTPS, 443 for HTTPS. - Path: For HTTP/HTTPS, the path to probe (e.g., /health). Default is "/". - Interval: How often probes are sent (default 30 seconds). - Timeout: How long to wait for a response (default 10 seconds). - Tolerated number of failures: Number of consecutive failures before marking endpoint as degraded (default 3).
An endpoint is considered healthy only if it responds within the timeout for the tolerated number of probes. If an endpoint is degraded, Traffic Manager stops returning it in DNS responses (unless all endpoints are degraded, in which case all are returned).
Interaction with DNS Caching
Traffic Manager sets the TTL on DNS responses (default 300 seconds). Clients and DNS resolvers cache the response for the TTL duration. This means routing changes (e.g., failover) are not immediate; they take effect only after the TTL expires and the client re-queries. For faster failover, you can reduce the TTL to as low as 30 seconds, but this increases DNS query load.
Configuration with Azure CLI
Create a Traffic Manager profile:
az network traffic-manager profile create \
--name MyProfile \
--resource-group MyRG \
--routing-method Priority \
--unique-dns-name myapp \
--monitor-protocol HTTP \
--monitor-port 80 \
--monitor-path /healthAdd endpoints:
az network traffic-manager endpoint create \
--name Endpoint1 \
--type azureEndpoints \
--profile-name MyProfile \
--resource-group MyRG \
--target-resource-id /subscriptions/.../microsoft.web/sites/myapp1 \
--priority 1Update routing method:
az network traffic-manager profile update \
--name MyProfile \
--resource-group MyRG \
--routing-method WeightedVerification
Use nslookup or dig to see which endpoint is returned:
nslookup myapp.trafficmanager.netCheck health status via Azure Portal or CLI:
az network traffic-manager endpoint show \
--name Endpoint1 \
--profile-name MyProfile \
--resource-group MyRG \
--query 'endpointMonitorStatus'Client DNS Query Initiation
A user types a URL (e.g., myapp.trafficmanager.net) in their browser. The browser sends a DNS query to the configured DNS resolver (usually the ISP's resolver or a public resolver like 8.8.8.8). The resolver does not have the IP cached, so it queries Azure's authoritative DNS servers. Traffic Manager intercepts this query at the DNS layer. The client's IP address is not directly visible; only the DNS resolver's IP is known. This is a critical point: Traffic Manager makes routing decisions based on the DNS resolver's location, not the end user's.
Routing Method Evaluation
Traffic Manager evaluates the routing method configured on the profile. For Priority, it selects the highest-priority healthy endpoint. For Weighted, it uses a weighted random selection among healthy endpoints. For Performance, it looks up the DNS resolver's IP in a latency table and selects the endpoint with the lowest latency. For Geographic, it determines the geographic region of the DNS resolver's IP and returns the mapped endpoint. For Subnet, it checks if the DNS resolver's IP falls within any defined CIDR range. If no healthy endpoint matches, Traffic Manager may return a default endpoint or all endpoints, depending on the routing method.
Health Check Verification
Before returning an endpoint, Traffic Manager checks the health status of the candidate endpoint. Health status is determined by periodic probes (every 30 seconds by default). An endpoint is healthy if it has responded successfully to the last N probes (N = tolerated number of failures, default 3). If the endpoint is degraded, Traffic Manager skips it and evaluates the next candidate according to the routing method. If all endpoints are degraded, Traffic Manager returns all endpoints (the client may experience failure). Health check results are cached for up to 10 seconds before being refreshed.
DNS Response with Endpoint
Traffic Manager constructs a DNS response containing a CNAME record that points to the chosen endpoint's domain name (e.g., myapp.azurewebsites.net). The response includes a TTL value (default 300 seconds). The DNS resolver caches this response for the TTL duration. The browser then performs a second DNS query to resolve the CNAME target to an IP address. This second resolution is not managed by Traffic Manager. The client then connects directly to the endpoint's IP, bypassing Traffic Manager entirely.
Direct Client-to-Endpoint Connection
Once the client obtains the IP address of the endpoint (e.g., through normal DNS resolution of the CNAME target), it establishes a direct TCP connection to that IP. Traffic Manager is not involved in this connection. All subsequent traffic flows directly between the client and the endpoint. If the endpoint fails after the connection is established, Traffic Manager does not intervene; the client must handle failure (e.g., by retrying the DNS query after TTL expiry). This is why Traffic Manager is considered a DNS-level load balancer, not a proxy.
Scenario 1: Active-Passive Disaster Recovery
A multinational e-commerce company uses Priority routing to implement active-passive failover between two Azure regions: West US (primary) and East US (secondary). The primary region hosts the production web app. If the primary region becomes unavailable (e.g., due to a regional outage), Traffic Manager automatically routes traffic to the secondary region. The health check probes the /health endpoint on the web app every 30 seconds. If three consecutive probes fail (90 seconds), the endpoint is marked degraded. The TTL is set to 60 seconds for faster failover. In production, this setup provides a recovery time objective (RTO) of about 2 minutes. A common mistake is setting the TTL too low (e.g., 30 seconds), which increases DNS query load and may cause DNS resolver throttling. Another mistake is not configuring the secondary region to handle full production load, leading to performance degradation during failover.
Scenario 2: Global Performance Optimization
A SaaS provider serves users worldwide. They deploy the application in three Azure regions: West Europe, Southeast Asia, and West US. They configure Performance routing to direct users to the region with the lowest latency. The latency table is automatically maintained by Azure. However, the company notices that users in Australia are sometimes routed to Southeast Asia instead of the closer Australia East region. This happens because the DNS resolver in Australia may have lower measured latency to Southeast Asia due to network paths. To fix this, they add an endpoint in Australia East and use a nested profile: Geographic routing at the top level to send Australian users to a child profile that uses Performance routing within Australia. This ensures Australian users are always directed to the Australian region.
Scenario 3: Gradual Rollout with Weighted Routing
A company deploys a new version of their web app. They have two endpoints: production (version 1) and staging (version 2). They configure Weighted routing with weights 90 and 10, respectively. This sends 10% of DNS queries to the new version. After monitoring for errors, they gradually increase the weight of the new version to 50, then 100. A common pitfall is forgetting that DNS caching can cause some users to still see the old version for up to the TTL duration. To mitigate, they set a low TTL (60 seconds) during the rollout. Also, if the staging endpoint becomes unhealthy, Traffic Manager automatically sends all traffic to the production endpoint, preventing impact on users.
AZ-104 Exam Focus on Traffic Manager Routing Methods
This topic falls under objective 4.2: 'Configure and manage Azure Traffic Manager.' The exam tests your ability to select the correct routing method for a given scenario, understand health check configuration, and identify failure behaviors. Expect 2–3 questions on Traffic Manager, often in scenario-based format.
#### Common Wrong Answers and Why Candidates Choose Them
Choosing Performance routing when the requirement is failover: Candidates see 'lowest latency' and pick Performance, but the scenario says 'if primary fails, route to secondary.' The correct answer is Priority. Performance routing does not guarantee failover order; it only optimizes latency.
Assuming Geographic routing handles failover: A scenario says 'EU users must go to EU region; if EU region fails, go to US.' Candidates choose Geographic, but Geographic routing does NOT fail over to another region if the mapped endpoint is unhealthy. The correct approach is to use nested profiles: Geographic at top, with a child Priority profile inside each region.
Believing Weighted routing guarantees exact traffic split: The exam may ask 'which routing method ensures exactly 50% traffic to each endpoint?' Weighted routing is probabilistic; the actual split may vary due to DNS caching. The correct answer is that no DNS-based routing method guarantees exact split; for precise load balancing, use Azure Load Balancer.
Confusing health check interval with TTL: A question may ask 'how long does it take for Traffic Manager to detect an endpoint failure?' Candidates might answer 300 seconds (the default TTL), but health detection is based on the probe interval (30 seconds) and tolerated failures (3), so about 90 seconds. TTL affects how long clients cache the old response, not detection time.
#### Specific Numbers and Terms to Memorize - Default health probe interval: 30 seconds - Default tolerated number of failures: 3 - Default timeout: 10 seconds - Default TTL: 300 seconds - Weight range: 1–1000 - Priority must be unique - Geographic routing uses ISO country codes - Subnet routing uses CIDR notation - Nested profiles allow combining routing methods
#### Edge Cases and Exceptions - If all endpoints are degraded, Traffic Manager returns all endpoints (the 'all endpoints' behavior). This can cause 'brownout' where clients get unhealthy endpoints. - Performance routing uses the DNS resolver's IP, not the client's IP. This can lead to suboptimal routing for users using corporate VPNs or public DNS like 8.8.8.8. - Geographic routing requires a default endpoint if you want to handle unmapped regions. If no default and region is unmapped, the query gets no response (NXDOMAIN). - Subnet routing can be used with a default endpoint for unmapped IPs.
#### How to Eliminate Wrong Answers - If the scenario mentions failover, look for Priority or nested profiles with Priority. - If it mentions load distribution based on capacity, look for Weighted. - If it mentions latency or nearest region, look for Performance. - If it mentions data sovereignty or geo-restrictions, look for Geographic. - If it mentions specific client IP ranges, look for Subnet. - Always check if health check behavior is described: if the question implies automatic failover to another region, Geographic alone is insufficient. - Remember that Traffic Manager is DNS-based: it cannot influence traffic after the initial DNS resolution.
Traffic Manager is a DNS-based load balancer; it does not proxy traffic.
Priority routing is for failover; Weighted for load distribution; Performance for latency; Geographic for geo-compliance; Subnet for IP-based routing.
Default health probe interval is 30 seconds; default tolerated failures is 3; detection time ~90 seconds.
Default DNS TTL is 300 seconds; lower TTL for faster failover but more DNS queries.
Geographic routing does not fail over automatically; use nested profiles for failover within regions.
Performance routing uses DNS resolver IP, not end user IP; may cause suboptimal routing.
Weighted routing is probabilistic; does not guarantee exact traffic split.
If all endpoints are unhealthy, Traffic Manager returns all endpoints.
Nested profiles allow combining routing methods (e.g., Geographic + Priority).
Use Azure CLI: az network traffic-manager profile create and endpoint create.
These come up on the exam all the time. Here's how to tell them apart.
Priority Routing
Used for active-passive failover with a clear order of preference.
Returns the highest-priority healthy endpoint; no load distribution.
Priorities must be unique integers; lower number = higher priority.
If the primary endpoint fails, traffic moves to the next priority.
Ideal for disaster recovery scenarios where only one region is active.
Weighted Routing
Used for load distribution across endpoints based on capacity.
Returns endpoints proportionally to assigned weights (probabilistic).
Weights are integers from 1 to 1000; default is 1.
If one endpoint fails, its weight is redistributed among remaining healthy endpoints.
Ideal for A/B testing or gradual rollouts.
Performance Routing
Routes based on lowest latency from DNS resolver to Azure region.
Automatically uses Azure's latency table; no manual mapping.
Does not consider data sovereignty or geographic boundaries.
If the closest endpoint is unhealthy, routes to next closest healthy endpoint.
Best for global apps where performance is the primary goal.
Geographic Routing
Routes based on geographic location of DNS resolver (country/region).
Requires explicit mapping of regions to endpoints.
Used for compliance with data residency laws.
Does NOT fail over to another region if mapped endpoint is unhealthy.
Best for scenarios requiring strict geographic boundaries.
Mistake
Traffic Manager can route based on the end user's IP address.
Correct
Traffic Manager sees only the DNS resolver's IP address, not the end user's IP. Routing decisions (Performance, Geographic, Subnet) are based on the resolver's IP. This can lead to inaccurate routing if the resolver is far from the user.
Mistake
Weighted routing guarantees an exact percentage of traffic to each endpoint.
Correct
Weighted routing is probabilistic. Due to DNS caching, the actual traffic distribution may deviate from the configured weights. The weights are applied to DNS queries, not individual requests. Over a large number of queries, the distribution approximates the weights, but it is not exact.
Mistake
Geographic routing automatically fails over to another region if the mapped endpoint is unhealthy.
Correct
Geographic routing does NOT fail over to another region. If the endpoint mapped to a region is unhealthy, Traffic Manager still returns that endpoint (or returns nothing if no default is configured). To achieve failover within a geographic region, you must use nested profiles with Priority routing inside the child profile.
Mistake
Performance routing measures latency between the end user and the endpoint.
Correct
Performance routing measures latency between Azure regions and the DNS resolver, not the end user. The latency table is built from probes between Azure datacenters and internet DNS resolvers. This can result in suboptimal routing if the DNS resolver is not close to the user.
Mistake
Traffic Manager can load balance traffic at the packet level.
Correct
Traffic Manager operates at DNS level (Layer 7). It does not inspect packets or terminate connections. It only responds to DNS queries with an endpoint IP. Actual traffic flows directly between client and endpoint. For packet-level load balancing, use Azure Load Balancer (Layer 4).
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Traffic Manager operates at DNS level (Layer 7) and distributes traffic globally based on routing methods. It does not terminate traffic; it only responds to DNS queries. Azure Load Balancer operates at Layer 4 and distributes traffic within a region based on IP and port. Load Balancer proxies traffic and can perform health checks on backend pools. Use Traffic Manager for multi-region failover and performance optimization; use Load Balancer for regional load balancing.
Traffic Manager performs health checks by sending probes every 30 seconds (default). If an endpoint fails to respond within the timeout (10 seconds) for a configurable number of consecutive probes (default 3), it is marked as degraded. Traffic Manager stops returning that endpoint in DNS responses. If all endpoints are degraded, Traffic Manager returns all endpoints (this may cause client failures).
Yes, use Geographic routing. You map countries (ISO codes) to specific endpoints. Traffic Manager determines the user's country from the DNS resolver's IP address. However, note that it does not fail over to another country if the mapped endpoint is unhealthy. To implement failover, use nested profiles with Priority routing inside each geographic region.
The default TTL is 300 seconds (5 minutes). You can change it to as low as 30 seconds for faster failover, but this increases DNS query load. A lower TTL means clients re-query sooner, allowing Traffic Manager to respond with a different endpoint more quickly after a failover.
Use Subnet routing. You define CIDR ranges and map them to endpoints. For example, map 10.0.0.0/8 to an internal endpoint. You can also set a default endpoint for unmapped IPs. Traffic Manager checks the DNS resolver's IP against the defined ranges.
A nested profile is a Traffic Manager profile that is added as an endpoint to another Traffic Manager profile. This allows combining routing methods. For example, use Geographic routing at the top level to send EU users to a child profile that uses Performance routing within Europe. Nested profiles are useful for complex routing policies that require both geographic and performance considerations.
Yes, you can add external endpoints to a Traffic Manager profile. These endpoints can be on-premises servers or any internet-accessible service. Traffic Manager will perform health checks on them (if configured) and include them in routing decisions. However, the on-premises server must be reachable from Azure's health probe IPs.
You've just covered Azure Traffic Manager Routing Methods — now see how well it sticks with free AZ-104 practice questions. Full explanations included, no account needed.
Done with this chapter?