Microsoft Azure — Azure DNS & Traffic Manager
Azure DNS zones, record sets, Traffic Manager routing methods, and endpoint monitoring..
20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.
- ✓Azure subscription, Azure CLI installed (version 2.40+), basic understanding of DNS concepts (A, CNAME, NS records), familiarity with Azure Resource Manager, a domain name registered with a registrar that allows custom NS records.
Azure DNS & Traffic Manager is like having a specialized tool that handles dns traffic manager in the Microsoft cloud — you manage the configuration, Azure handles the infrastructure.
| Chrome | Firefox | Safari | Edge |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ |
Azure is Microsoft's cloud computing platform offering over 200 services. This article covers azure dns & traffic manager with production-ready configurations, best practices, and hands-on examples.
Azure DNS: The Foundation of Cloud Naming
Azure DNS is a hosting service for DNS domains that provides name resolution using Microsoft Azure infrastructure. By hosting your domains in Azure, you can manage your DNS records using the same credentials, APIs, tools, and billing as your other Azure services. Azure DNS supports common DNS record types like A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, and TXT. It also supports alias records, which can point to Azure resources like public IP addresses, Traffic Manager profiles, or Azure CDN endpoints. Alias records are a key differentiator because they automatically update when the underlying resource's IP changes, eliminating manual updates. For production, use Azure DNS with at least two name servers (Azure provides four) and configure TTLs appropriately: low TTLs (300 seconds) for active failover scenarios, higher TTLs (3600 seconds) for stable records to reduce query load. Avoid using CNAME records at the zone apex; instead, use alias records or A records with a static IP. Azure DNS is zone-based, meaning you create a DNS zone for your domain and then manage records within that zone. Delegation is done by updating your registrar's NS records to point to Azure's name servers. This setup is critical for any cloud-native application that requires reliable, low-latency DNS resolution.
Traffic Manager: Global Load Balancing with DNS
Azure Traffic Manager is a DNS-based traffic load balancer that distributes traffic to your public-facing applications across global Azure regions. It works by responding to DNS queries with the appropriate endpoint based on the traffic-routing method and the health of each endpoint. Traffic Manager supports multiple routing methods: Priority (active/passive failover), Weighted (round-robin with weights), Performance (closest region based on latency), Geographic (geographic location of the user), Multivalue (returns all healthy endpoints), and Subnet (maps IP ranges to endpoints). Each endpoint is monitored via HTTP/HTTPS/TCP health probes. If an endpoint fails health checks, Traffic Manager removes it from DNS responses. For production, always configure health probes with a short interval (10 seconds) and a low number of failures (2-3) to detect outages quickly. Use the Performance routing method for global applications to minimize latency. Be aware of DNS caching: clients and resolvers cache DNS responses based on TTL. Traffic Manager's TTL can be set as low as 5 seconds, but many resolvers ignore low TTLs. For critical failover, combine Traffic Manager with Azure Front Door or Application Gateway for faster convergence.
Integrating Azure DNS with Traffic Manager
The true power of Azure DNS and Traffic Manager emerges when they are integrated. By creating an alias record in Azure DNS that points to a Traffic Manager profile, you get a seamless global load balancing solution. The alias record automatically resolves to the IP addresses of the healthy endpoints selected by Traffic Manager. This integration eliminates the need to manually update DNS records when endpoints change. To set this up, first create a Traffic Manager profile with your endpoints and health probes. Then, in your Azure DNS zone, create an A or AAAA record set with the alias record type, targeting the Traffic Manager profile's resource ID. Traffic Manager responds to DNS queries with the appropriate endpoint IP based on the routing method. For production, use the Performance routing method to direct users to the closest healthy region. Combine with Azure DNS Private Zones for internal resolution if needed. Monitor both services: use Azure Monitor for DNS query volume and Traffic Manager endpoint health. Set up alerts for when all endpoints are degraded. Remember that Traffic Manager is not a replacement for a load balancer; it operates at the DNS level and does not inspect traffic. For layer 7 routing, use Azure Application Gateway or Front Door.
Routing Methods: Choosing the Right Strategy
Traffic Manager offers six routing methods, each suited for different scenarios. Priority routing is for active-passive failover: you assign a priority to each endpoint, and Traffic Manager sends all traffic to the highest priority healthy endpoint. This is ideal for disaster recovery where you have a primary region and a standby. Weighted routing distributes traffic based on weights, useful for A/B testing or gradual rollouts. Performance routing directs users to the endpoint with the lowest latency, based on the user's DNS resolver IP. This is the most common for global applications. Geographic routing sends traffic based on the geographic location of the DNS query, useful for content localization or data sovereignty. Multivalue routing returns all healthy endpoints in the DNS response, and the client chooses one. This is good for scenarios where the client can handle multiple IPs. Subnet routing maps specific IP ranges to endpoints, useful for internal testing or VIP access. In production, avoid using Geographic routing for failover because it does not fall back to other regions if the mapped region is unhealthy. Instead, combine Geographic with Priority by using nested profiles. For most global apps, Performance routing with multiple endpoints in each region is the best choice.
Health Monitoring and Failover Configuration
Traffic Manager continuously monitors the health of each endpoint using HTTP/HTTPS/TCP probes. You configure the protocol, port, path, and expected status code. The probe interval can be 10 or 30 seconds, and the number of failures before marking an endpoint as degraded is configurable (default 3). For production, set the interval to 10 seconds and the failure threshold to 2 for fast detection. The health endpoint should be lightweight but reflect the actual application health. For example, an ASP.NET Core app might have a /health endpoint that checks database connectivity and cache. Avoid heavy operations like full page rendering. Traffic Manager also supports custom headers for health probes, which can be used to bypass authentication or firewalls. When an endpoint is degraded, Traffic Manager stops returning it in DNS responses. However, due to DNS caching, clients may still try the degraded endpoint for up to the TTL duration. To mitigate, set a low TTL (e.g., 30 seconds) on the Traffic Manager profile. For critical applications, combine with Azure Front Door which uses anycast and can fail over in seconds. Monitor endpoint health using Azure Monitor and set up alerts for when all endpoints are degraded. Also, consider using multi-region deployment with at least two endpoints per region for redundancy.
Nested Traffic Manager Profiles for Complex Routing
Nested Traffic Manager profiles allow you to combine routing methods for sophisticated traffic management. For example, you can use Geographic routing at the top level to direct users to a region, and within each region, use Performance routing to select the best endpoint. To create a nested profile, you add a Traffic Manager profile as an endpoint of another profile. The child profile must be of type 'externalEndpoints' and its target is the DNS name of the child profile. Nested profiles are useful for multi-layered failover: for instance, a Priority profile with a primary region endpoint and a secondary region endpoint, where each region endpoint is itself a Performance profile with multiple endpoints. This gives you both regional failover and intra-region load balancing. Be mindful of the TTL cascade: the parent profile's TTL should be equal to or greater than the child's TTL to avoid unnecessary queries. Also, health probes propagate: if all endpoints in a child profile are degraded, the child profile endpoint is marked degraded in the parent. Nested profiles increase complexity, so document your architecture thoroughly. Use them only when necessary; for most applications, a single Performance profile with endpoints in multiple regions suffices.
Performance Optimization and Caching Considerations
DNS caching is the biggest challenge with Traffic Manager. DNS resolvers (ISP, corporate, public like 8.8.8.8) cache DNS responses based on the TTL. Even if you set a low TTL (e.g., 5 seconds), many resolvers ignore it and cache for longer (some up to 5 minutes). This means failover can be delayed. To mitigate, use Azure DNS with alias records and set the Traffic Manager TTL as low as possible (minimum 5 seconds). For critical applications, consider using Azure Front Door, which uses anycast and can fail over in seconds without DNS caching issues. Another optimization is to use the Performance routing method, which directs users to the closest endpoint based on the DNS resolver's IP. However, this is not the same as the user's actual IP; it's the resolver's IP. For more accurate latency routing, use Azure Front Door with latency-based routing. Also, consider using multiple Traffic Manager profiles for different user segments (e.g., internal vs external). Monitor DNS query latency using Azure Monitor and set alerts for high latency. Finally, use Azure DNS Private Zones for internal resolution to avoid public DNS caching.
Monitoring, Alerts, and Troubleshooting
Monitoring Azure DNS and Traffic Manager is essential for production reliability. Use Azure Monitor to track metrics like DNS query volume (for zones), endpoint health status, and probe latency. Set up alerts for when an endpoint is degraded or when all endpoints are degraded. For Traffic Manager, key metrics include: 'Probe Agent Count' (number of healthy endpoints), 'QpsByEndpoint' (queries per second per endpoint), and 'EndpointStatus'. For Azure DNS, monitor 'QueryVolume' and 'RecordSetCount'. Use Azure Log Analytics to query logs for DNS resolution failures. Common issues: misconfigured health probes (wrong path, port, or protocol), firewall blocking probes, and TTL misconfigurations. To troubleshoot, use tools like dig or nslookup to check DNS resolution. For example, dig @ns1-01.azure-dns.com www.example.com to query Azure DNS directly. For Traffic Manager, use nslookup myapp.trafficmanager.net to see which IPs are returned. If an endpoint is not receiving traffic, check its health status in the Azure portal. Also, verify that the endpoint's firewall allows Traffic Manager's probe IPs (which are documented and change over time). Use Azure Resource Health to check if there are any Azure platform issues.
Disaster Recovery and Multi-Region Architectures
Azure DNS and Traffic Manager are key components of a multi-region disaster recovery strategy. The typical architecture involves deploying your application in at least two Azure regions (e.g., East US and West Europe) and using Traffic Manager to route traffic. For active-passive, use Priority routing: primary region gets priority 1, secondary gets priority 2. For active-active, use Performance routing to distribute traffic. In both cases, ensure each region can handle the full load if the other fails. Use Azure DNS alias records to point to the Traffic Manager profile. For database, use geo-replication (e.g., Azure SQL Database active geo-replication or Cosmos DB multi-region writes). For storage, use geo-redundant storage (GRS). Test your failover regularly: simulate a region outage by disabling the endpoint in Traffic Manager. Monitor the failover time and ensure it meets your RTO. Document the runbook for manual failover if needed. Also, consider using Azure Front Door for global HTTP load balancing with instant failover. For DNS-level failover, Traffic Manager is sufficient for most applications, but be aware of DNS caching delays. Use Azure Traffic Manager's 'Always Serve' feature to ensure endpoints are always returned even if degraded (not recommended for production).
Cost Management and Scaling Considerations
Azure DNS and Traffic Manager have predictable pricing. Azure DNS charges based on the number of zones and the number of DNS queries. Traffic Manager charges per million DNS queries and per endpoint (after the first 1000 endpoints free). For high-traffic applications, costs can add up. To optimize, minimize the number of DNS queries by using longer TTLs for stable records. For Traffic Manager, use the 'Performance' routing method which may reduce queries by directing users to the closest endpoint. Also, consider using Azure DNS Private Zones for internal traffic to avoid public DNS costs. For scaling, Traffic Manager can handle millions of queries per second, but you may need to distribute load across multiple profiles for very high traffic. Use Azure Monitor to track query volumes and set budgets. Another cost consideration: alias records in Azure DNS are free, but they generate DNS queries to Traffic Manager, which are billed. For global applications, consider using Azure Front Door which includes DNS and traffic management with a different pricing model. Finally, use Azure Cost Management to set alerts for unexpected spikes.
Security Best Practices for DNS and Traffic Manager
Securing Azure DNS and Traffic Manager involves protecting your DNS zones from unauthorized changes and ensuring traffic integrity. Use Azure RBAC to restrict who can modify DNS zones and Traffic Manager profiles. Assign the 'DNS Zone Contributor' role only to necessary personnel. Enable Azure Policy to enforce that alias records are used instead of CNAME at apex. For Traffic Manager, use managed identities for endpoints to avoid using connection strings. Protect health probes by using HTTPS and custom headers to prevent spoofing. Do not expose sensitive information in health probe responses. Use Azure Firewall or NSGs to restrict access to health endpoints only from Traffic Manager probe IPs (use service tags). For DNS, enable DNSSEC (Domain Name System Security Extensions) to prevent cache poisoning. Azure DNS supports DNSSEC with zone signing. Also, use Azure Private DNS Zones for internal resources to avoid exposure to the internet. Monitor for unauthorized changes using Azure Activity Logs and set up alerts for any modifications to DNS zones or Traffic Manager profiles. Finally, regularly audit your DNS records and Traffic Manager configuration for misconfigurations.
Migration from Third-Party DNS to Azure DNS
Migrating from a third-party DNS provider (e.g., AWS Route53, Cloudflare, GoDaddy) to Azure DNS involves several steps. First, export your existing DNS records in a standard format (e.g., BIND zone file). Azure DNS supports importing zone files. Use the Azure CLI or portal to create the zone and import records. For large zones, use Azure PowerShell or CLI scripts. After import, verify all records are correct. Then, update the NS records at your registrar to point to Azure DNS name servers. This is the critical step: the delegation change propagates according to the TTL of the NS records (usually 48 hours). To minimize downtime, lower the TTL of your NS records at the registrar before the migration. Also, keep the old DNS provider active until propagation completes. For Traffic Manager, you can create the profile and endpoints in Azure, then update your DNS records to point to Traffic Manager. If you are migrating from another load balancer, ensure health probes are configured correctly. Test thoroughly before cutting over. Use Azure DNS's alias records to simplify future changes. Document the migration plan and have a rollback strategy. For complex migrations, consider using Azure Migrate or third-party tools.
Azure DNS Private Resolver: Hybrid Name Resolution Without Custom VMs
Azure DNS Private Resolver is a fully managed service that provides DNS resolution between Azure VNets and on-premises networks without deploying custom DNS VMs. It uses inbound endpoints (receives DNS queries from on-premises) and outbound endpoints (sends DNS queries to on-premises via DNS forwarding rulesets). The inbound endpoint provides an IP address to forward queries from on-premises DNS servers into Azure — private DNS zones linked to the VNet are resolved automatically. Outbound endpoints are linked to DNS forwarding rulesets, which define rules for specific DNS namespaces (e.g., forward contoso.com to on-premises DNS at 192.168.1.10). In production, deploy DNS Private Resolver in the hub VNet with both inbound and outbound endpoints. Link forwarding rulesets to spoke VNets so they can resolve hybrid names without direct zone links. This is a significant improvement over running custom DNS VMs — no OS patching, no HA configuration, and auto-scaling. Key configuration: create forwarding rulesets with rules for your hybrid domains, link the ruleset to spoke VNets, and configure on-premises DNS to forward Azure zones to the inbound endpoint IP. Avoid linking a ruleset to the same VNet where the inbound endpoint resides to prevent DNS resolution loops. DNS Private Resolver supports up to 1000 forwarding rules per ruleset and 500 VNet links per ruleset.
Traffic Manager Real User Measurements: Data-Driven Routing Optimization
Traffic Manager Real User Measurements (RUM) is a feature that collects network latency measurements from actual user browsers to Azure regions, enabling data-driven routing decisions. When enabled, users' browsers measure latency to Azure regions using a JavaScript embedded in web pages, and the measurements are sent to Traffic Manager to influence the Performance routing method. This is more accurate than relying on DNS resolver IP-based latency approximation, because it measures the actual user's network path rather than their DNS resolver's location. In production, embed the RUM JavaScript in your application's landing page to collect real user latency data. Use the Heat Map in Traffic Manager to visualize latency across regions. RUM is available at no extra cost and works with Performance routing. The key benefit: users behind a corporate DNS resolver in a different geographic location will be routed to the Azure region with the lowest actual latency from their device, not from the resolver. RUM data is anonymized and aggregated. For accurate results, ensure your web application has sufficient traffic volume (at least 1000 measurements per region per day). Combine RUM with Traffic View for a complete picture of user traffic patterns and regional performance. Use the Heat Map REST API to integrate RUM data into custom dashboards.
Azure Private DNS Zones and Hybrid Resolution: Deep Dive
Azure Private DNS Zones provide custom DNS resolution within VNets without exposing records to the internet. Linked VNets can resolve records in the zone, and auto-registration can dynamically create A records for VMs. In production, use Private DNS Zones for internal service discovery: create zones like internal.contoso.com and add records for databases, caches, and internal APIs. Link zones only to the hub VNet and use DNS forwarding rulesets (with DNS Private Resolver) to enable spoke VNets to resolve private zone records — this avoids linking every spoke directly, reducing zone link limits. For hybrid resolution: configure on-premises DNS servers with conditional forwarders for your Azure private zones pointing to the DNS Private Resolver inbound endpoint IP. Azure Private DNS now supports 'Fallback to Internet' — if no record is found in the private zone, Azure DNS falls back to public DNS. Enable this for phased migrations where you have partial zone coverage. Key design patterns: (1) Centralized DNS: link private zones only to hub VNet, use DNS Private Resolver for spoke and on-premises resolution. (2) Distributed DNS: link each spoke VNet directly to private zones — simpler but hits zone link limits faster (max 500 VNet links per zone). For enterprise landing zones, use the centralized pattern: deploy DNS Private Resolver in the connectivity hub VNet, create forwarding rulesets for hybrid domains, and link rulesets to all spoke VNets. This scales to hundreds of spokes.
| File | Command / Code | Purpose |
|---|---|---|
| create-zone.sh | az network dns zone create \ | Azure DNS |
| create-traffic-manager.sh | az network traffic-manager profile create \ | Traffic Manager |
| create-alias-record.sh | az network dns record-set a add-record \ | Integrating Azure DNS with Traffic Manager |
| create-weighted-profile.sh | az network traffic-manager profile create \ | Routing Methods |
| HealthCheckController.cs | [ApiController] | Health Monitoring and Failover Configuration |
| create-nested-profile.sh | az network traffic-manager profile create \ | Nested Traffic Manager Profiles for Complex Routing |
| set-ttl.sh | az network traffic-manager profile update \ | Performance Optimization and Caching Considerations |
| troubleshoot-dns.sh | dig @ns1-01.azure-dns.com www.example.com | Monitoring, Alerts, and Troubleshooting |
| failover-test.sh | az network traffic-manager endpoint update \ | Disaster Recovery and Multi-Region Architectures |
| enable-dnssec.sh | az network dns zone update \ | Security Best Practices for DNS and Traffic Manager |
| import-zone.sh | az network dns zone import \ | Migration from Third-Party DNS to Azure DNS |
| create-dns-resolver.sh | az network dns-resolver create \ | Azure DNS Private Resolver |
| rum-snippet.js | Traffic Manager Real User Measurements | |
| private-dns-hybrid.sh | az network private-dns zone create \ | Azure Private DNS Zones and Hybrid Resolution |
Key takeaways
Common mistakes to avoid
3 patternsNot planning dns traffic manager properly before deployment
Ignoring Azure best practices for dns traffic manager
Overlooking cost implications of dns traffic manager
Interview Questions on This Topic
Explain Azure DNS & Traffic Manager and its use cases.
Frequently Asked Questions
20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.
That's Azure. Mark it forged?
11 min read · try the examples if you haven't