Lesson 17 — DNS in Azure
Why DNS Matters for Azure Administrators
DNS is the nervous system of every network, and Azure's DNS story has three distinct layers that every AZ-104 candidate must understand: public DNS hosting (Azure DNS), private DNS zones for VNet-internal resolution, and the specialised private endpoint DNS zones that make PaaS service private connectivity actually work.
In the exam, DNS scenarios appear in the context of hybrid connectivity, private endpoints, and custom DNS configuration. Getting these wrong in production leads to silent failures — traffic resolves to a public IP instead of the private endpoint, or on-premises clients cannot reach Azure private zones. This lesson gives you the complete mental model.
1. Azure DNS — Public Zones
Azure DNS is a hosting service for DNS domains. You can host your public DNS domains in Azure and manage DNS records using the same RBAC and tools as all your other Azure resources. Azure DNS is backed by Microsoft's global anycast network, delivering high availability and fast resolution worldwide.
How delegation works
- Register
contoso.comat your domain registrar. - Create a DNS zone called
contoso.comin Azure DNS. - Azure assigns four name server hostnames to your zone (e.g.
ns1-01.azure-dns.com). - At your registrar, update the NS records for
contoso.comto point to these four Azure name servers. - Azure DNS is now authoritative for
contoso.com.
2. DNS Record Types
Azure DNS supports the full set of standard DNS record types. The following table covers every type you need to know for the exam:
| Record Type | Purpose | Exam Notes |
|---|---|---|
| A | Maps a hostname to an IPv4 address | Most common record type |
| AAAA | Maps a hostname to an IPv6 address | Same semantics as A but for IPv6 |
| CNAME | Alias — points one hostname to another FQDN | Cannot be used at the zone apex (e.g. contoso.com itself). Can be used for subdomains like www.contoso.com. |
| MX | Mail exchange — specifies mail servers for the domain | Points to an FQDN (not an IP). Lower priority number = higher preference. |
| TXT | Arbitrary text — used for domain verification, SPF, DKIM, DMARC | Common in exam scenarios involving email security and domain ownership verification |
| SRV | Service location — specifies host and port for a service | Used by protocols like SIP, XMPP, Kerberos |
| NS | Name server — delegates a DNS zone to a set of name servers | Auto-created by Azure when you create a zone. Used for subdomain delegation. |
| SOA | Start of authority — zone metadata (primary NS, contact, serial number) | Auto-created and managed by Azure. One per zone. |
| PTR | Reverse DNS — maps an IP address back to a hostname | Used for reverse lookup zones (e.g. 1.0.168.192.in-addr.arpa) |
| CAA | Certification Authority Authorization — specifies which CAs may issue certs for the domain | Security hardening — prevents mis-issuance by rogue CAs |
| Alias | Azure DNS extension — points to Azure resources directly (see below) | Can be used at the zone apex — solves the CNAME-at-apex problem |
3. Alias Records — Solving the Apex Problem
The DNS specification (RFC 1912) prohibits CNAME records at the zone apex — you cannot create a CNAME for contoso.com itself, only for subdomains like www.contoso.com. This is a problem when you want the root domain to point to an Azure resource that has a dynamic IP (like a Load Balancer).
Azure Alias records solve this. They are an Azure DNS extension that lets you create a record at the zone apex that points directly to:
- Azure Public Load Balancer (Standard SKU)
- Azure Traffic Manager profile
- Azure CDN endpoint
- Azure Front Door
contoso.com (the root/apex domain, not a subdomain) to an Azure Load Balancer or Traffic Manager — the answer is always an Alias record. A CNAME at the apex is technically invalid and Azure DNS will reject it.
4. Private DNS Zones
A Private DNS Zone is a DNS zone that is only resolvable from within Azure VNets that are linked to it — it does not appear on the public internet. Private DNS zones are the primary mechanism for internal name resolution in Azure, replacing the need for custom DNS server VMs in most pure-Azure scenarios.
VNet links and auto-registration
To use a private DNS zone from a VNet, you must create a VNet link. Each link can be configured in one of two modes:
| Link Type | Behaviour | Limit |
|---|---|---|
| Auto-registration enabled | Azure automatically creates and removes A records for VMs in the linked VNet as they start, stop, or are deleted. Records use the VM's hostname. | A VNet can be linked with auto-registration to only ONE private DNS zone |
| Resolution only | VMs in the linked VNet can resolve names in the private DNS zone, but records are not automatically created. | A VNet can have resolution-only links to multiple private DNS zones |
Use cases
- Internal naming for Azure VMs — VMs get a predictable FQDN like
vm-api-prod-001.internal.contoso.com - Name resolution for PaaS services accessed over Private Endpoints (critical — see next section)
- Multi-VNet environments where VMs in different VNets need to resolve a shared internal namespace
5. Private Endpoint DNS — The Critical Configuration
When you create a Private Endpoint for a PaaS service (covered in Lesson 16), the service's public FQDN must resolve to the private endpoint's private IP address — not the public Azure IP. This requires a specific private DNS zone named exactly according to Microsoft's privatelink naming convention.
Private DNS zone names per service
| Azure Service | Required Private DNS Zone |
|---|---|
| Azure Storage — Blob | privatelink.blob.core.windows.net |
| Azure Storage — File | privatelink.file.core.windows.net |
| Azure Storage — Queue | privatelink.queue.core.windows.net |
| Azure Storage — Table | privatelink.table.core.windows.net |
| Azure Key Vault | privatelink.vaultcore.azure.net |
| Azure SQL Database | privatelink.database.windows.net |
| Azure App Service / Functions | privatelink.azurewebsites.net |
| Azure Cosmos DB (SQL) | privatelink.documents.azure.com |
| Azure Container Registry | privatelink.azurecr.io |
| Azure Service Bus | privatelink.servicebus.windows.net |
How it works end-to-end
- Private Endpoint is created for
mykeyvault.vault.azure.net. Azure assigns it a private IP (e.g.10.1.1.5). - Azure creates a DNS A record:
mykeyvault.privatelink.vaultcore.azure.net → 10.1.1.5in the private DNS zone. - Azure public DNS returns a CNAME:
mykeyvault.vault.azure.net → mykeyvault.privatelink.vaultcore.azure.net. - When a VM in the linked VNet queries
mykeyvault.vault.azure.net, Azure DNS follows the CNAME to the private zone and returns10.1.1.5. - Traffic flows over the private IP through the VNet to the Private Endpoint — never over the public internet.
6. DNS Resolution Flow for Azure VMs
By default, Azure configures VMs to use 168.63.129.16 as their DNS server. This is a virtual IP managed by the Azure platform — it is always reachable from within any Azure VNet and is not a real machine.
What 168.63.129.16 resolves
- All public internet DNS names (acts as a recursive resolver via Microsoft's resolvers)
- Private DNS zones linked to the VNet the VM is in
- Auto-registered VM names from private DNS zones
- Internal Azure platform names (e.g. IMDS endpoint, health probe IPs)
7. Azure DNS Private Resolver
The Azure DNS Private Resolver is a managed, serverless DNS forwarding service that replaces the traditional pattern of running custom DNS VMs in Azure for hybrid DNS scenarios. It eliminates the operational overhead of maintaining DNS VMs (patching, HA, scaling).
| Component | Direction | Purpose |
|---|---|---|
| Inbound endpoint | On-premises → Azure | A private IP in your VNet. On-premises DNS servers forward queries for Azure private zones to this IP. The Private Resolver then resolves them using Azure DNS (including private zones). |
| Outbound endpoint | Azure → On-premises | Sends DNS queries from Azure VMs to on-premises DNS. Configured via forwarding rulesets — e.g. forward corp.local queries to on-premises DNS server 192.168.1.10. |
Deployment requirements
- Inbound and outbound endpoints are deployed into dedicated subnets (minimum /28) within a VNet.
- Subnets used for Private Resolver endpoints cannot contain other resources.
- Forwarding rulesets (for outbound) are associated with VNets — they define conditional forwarding rules (domain name → target DNS server IP).
8. Hybrid DNS Architecture
In hybrid environments where Azure VNets connect to on-premises networks via VPN or ExpressRoute, DNS resolution must work bidirectionally. The following architecture uses the DNS Private Resolver (preferred modern approach):
9. DNS TTL and Operational Considerations
TTL (Time-To-Live) controls how long DNS resolvers cache a record before re-querying the authoritative server. The right TTL depends on the stability of the record.
| Scenario | Recommended TTL | Reasoning |
|---|---|---|
| Pre-migration (before a planned DNS change) | 60 seconds (1 min) | Lower TTL 24–48 hours before migration so caches flush quickly when you cut over |
| Active failover / blue-green deployment | 60–300 seconds | Fast failover requires short TTL so clients pick up the new IP quickly |
| Stable production records (e.g. MX, NS) | 3600 seconds (1 hr) or higher | High TTL reduces DNS query load and improves resolution performance |
| Traffic Manager weighted routing (A/B test) | 0–30 seconds | Traffic Manager overrides TTL for fast rerouting — set the profile's TTL, not the individual record |
Check Your Understanding
Click any option to see immediate feedback. Answers reflect real Azure DNS behaviour.
1. You link a VNet to a private DNS zone named internal.contoso.com with auto-registration enabled. You then try to link the same VNet with auto-registration to a second private DNS zone named backend.contoso.com. What happens?
2. Your company wants to point contoso.com (the root/apex domain, not www.contoso.com) to an Azure Traffic Manager profile. What DNS record type must you create in Azure DNS?
3. You configure a custom DNS server VM in a VNet's DNS settings. Azure VMs in that VNet can resolve on-premises names correctly, but they can no longer resolve names in private DNS zones linked to the VNet. What is the most likely cause?
4. You create a Private Endpoint for an Azure Key Vault named myvault. A VM in the linked VNet queries myvault.vault.azure.net and receives the public IP instead of the private endpoint IP. The VM can reach the Key Vault but over the public internet. What configuration is most likely missing?
privatelink.vaultcore.azure.net), Azure DNS follows the public CNAME chain for myvault.vault.azure.net and returns the public IP. The zone must be exactly named privatelink.vaultcore.azure.net (not privatelink.vault.azure.net), the A record for myvault must be in it pointing to the private IP, and the zone must be linked to the VNet where the VM resides.5. Your organisation wants on-premises clients to resolve Azure private DNS zones, and Azure VMs to resolve on-premises corporate hostnames — without managing any DNS VMs in Azure. What is the recommended modern architecture?
6. You manage the DNS for contoso.com in Azure DNS. You need to configure email so that messages to @contoso.com are accepted by your mail provider at mail.mailprovider.com (higher priority) and backup.mailprovider.com (lower priority). Which configuration is correct?
mail.mailprovider.com at priority 10 and backup.mailprovider.com at priority 20 makes the first server the primary mail exchanger.Read the Private DNS zone overview, the Private Endpoint DNS configuration docs, and the DNS Private Resolver overview. Pay special attention to the private DNS zone names for each PaaS service — these are frequently tested.
This lesson covered Azure DNS architecture end to end. Go deeper on any of these:
- Walk me through configuring a complete private endpoint DNS setup for an Azure SQL Database using Bicep.
- How do you set up split-horizon DNS so internal clients resolve a name to a private IP while external clients resolve to the public IP?
- What is DNSSEC and does Azure DNS support it?
- How does Azure DNS Private Resolver differ in architecture from an Azure Firewall with DNS proxy enabled?