Azure DNS: Public and Private Zones and Records
30-second answer
Azure DNS hosts public DNS zones on Microsoft's global name servers. You delegate your domain by setting the zone's four name servers as NS records at your registrar (Azure DNS doesn't sell domains). You add record sets (A, AAAA, CNAME, MX, TXT, SRV, CAA, NS, PTR). A CNAME can't sit at the zone apex, so use an alias record, which points an A, AAAA or CNAME at an Azure resource such as a public IP, Traffic Manager or Front Door and follows it when it changes. Private DNS zones answer only virtual networks linked to them; a link with auto-registration creates A records for VMs in that VNet, and a VNet can have only one registration zone. VMs query Azure DNS at 168.63.129.16.
Simulate it » No Azure account neededExam objective: 4.3.1 Configure Azure DNS. (Skills measured as of April 17, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Search for <strong>DNS zones</strong>.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Search for DNS zones.
- Type dns zones in the search bar and pick DNS zones under Services.
- Host contoso-shop.com. The zone name is the domain you own.
- Azure gives the zone four name servers. Put them as the NS records at your domain registrar to delegate the domain to Azure DNS.
- Add www as an alias A record pointing at the load balancer's public IP resource. If the IP changes, the record follows. Alias records also work at the apex (@), where a CNAME isn't allowed.
- Now a private DNS zone, contoso.internal. It answers only VNets linked to it. Open Virtual Network Links → + Add.
- Link vnet-web and enable auto registration: VMs there get A records created and removed automatically. A VNet can have only one registration zone.
- The VMs registered themselves. VMs in the linked VNet resolve vm-web01.contoso.internal through Azure DNS at 168.63.129.16. An unlinked VNet gets NXDOMAIN.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
Azure DNS: public and private zones
A public zone answers the internet once you delegate the domain to Azure's name servers. Alias records point at Azure resources such as a public IP. A private zone answers only VNets with a virtual network link, and can auto-register VM names.
🤔 What happens if…
Read this tour as text
- VNets, subnets and a public IP. A virtual network is your private range in one region, split into subnets. Azure keeps 5 addresses in every subnet. A Standard public IP is static, zone-redundant where the region has zones, and closed to inbound traffic until an NSG opens it.
- Peering is not transitive. VNet peering joins two VNets over the Microsoft backbone. Each side has its own link, address spaces can't overlap, and the hub can share its VPN gateway (gateway transit). Peering never chains: spoke 1 and spoke 2 can't talk through the hub on their own.
- User-defined routes to the NVA. A route table on a subnet overrides system routes. Next hop Virtual appliance sends traffic to a firewall or NVA, which needs IP forwarding on its NIC. Longest prefix wins, and a user route beats a system route on the same prefix.
- NSGs, ASGs and effective rules. An NSG has rules checked by priority (100 to 4096, lowest first). Inbound traffic meets the subnet NSG first, then the NIC NSG, and both must allow. An application security group lets a rule say "to the web servers" instead of listing IPs.
- Azure Bastion. Azure Bastion lives in AzureBastionSubnet (/26 or larger) and opens RDP and SSH to VMs on their private IPs, from the portal over TLS 443 or with the native client on Standard and Premium. One Bastion in the hub serves peered spokes.
- Service endpoint vs private endpoint. A service endpoint sends a subnet's traffic to the service's public IP over the backbone, and the service firewall allows that subnet. A private endpoint gives the service a private IP in your VNet, and a privatelink private DNS zone makes the name resolve to it.
- Azure DNS: public and private zones. A public zone answers the internet once you delegate the domain to Azure's name servers. Alias records point at Azure resources such as a public IP. A private zone answers only VNets with a virtual network link, and can auto-register VM names.
- Standard load balancer and health probes. A load balancer spreads TCP/UDP flows from a frontend (public or internal) to a backend pool by load-balancing rules. A health probe pulls a VM out of rotation when it stops answering. Probes come from 168.63.129.16.
- Troubleshoot with Network Watcher. Network Watcher tools answer one question each. IP flow verify: which NSG rule allows or denies this flow? Next hop: where does this packet go? Connection troubleshoot: can A reach B, and if not, at which hop?
Put two web servers behind a Standard public load balancer, give it a friendly name with an Azure DNS alias record, then troubleshoot when one server drops out of rotation because an NSG rule blocks the health probe.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
DNS lives at the registrar, private names live in a hosts file, and nobody can change either.
😊 THE SOLUTION
Host public zones in Azure DNS and give VNets private zones with auto-registration.
- Records in three places✓ Zones as Azure resources with RBAC
- Record points at an old IP✓ Alias record to the resource
- VM names typed into hosts files✓ Private zone auto-registration
Start with a question
How does the post office know your business moved to a new address?
You file a forwarding notice with the council, and from then on letters for your business name go to the new place. If you forget the notice, letters keep going to the old address no matter how nice the new office is.
Azure DNS is the new office’s address book. Delegation is the forwarding notice: you tell your domain registrar that Azure’s name servers now answer for your domain. And for names only staff should know, like the server room, a private zone is the internal phone list that only works inside the building.
Explain it like I’m 10
The technical explanation
Public zones
Create a zone named after the domain (contoso-shop.com). Azure assigns four name servers (ns1-0x.azure-dns.com, .net, .org, .info). To make the internet use them, set them as the NS records at your registrar, or as an NS record set in the parent zone for a child zone (delegating shop.contoso.com from contoso.com). Azure DNS hosts zones; it doesn’t register domains (App Service Domains can).
Zones are Azure resources, so you get RBAC (DNS Zone Contributor), resource locks and activity logs. Price feel: about $0.50 per zone a month plus $0.40 per million queries (illustrative).
Records
| Type | Example | Notes |
|---|---|---|
| A / AAAA | www → 20.85.4.10 | IPv4 / IPv6 address |
| CNAME | shop → contoso.azurewebsites.net | Not at the apex, and alone on its name |
| MX | @ → mail.contoso.com (priority 10) | |
| TXT | @ → “v=spf1 …” | Verification, SPF |
| SRV, CAA, PTR, NS | Services, certificate authorities, reverse lookup, delegation | |
| SOA, NS at @ | Created for you |
Each record set has a TTL (3600 seconds by default) that controls how long resolvers cache it.
Alias records
An alias record set points at an Azure resource instead of a fixed value: a public IP, Traffic Manager profile, Azure Front Door or CDN endpoint, or another record set in the same zone. If the resource’s IP changes, the record follows, and if the resource is deleted the record returns nothing instead of a stale address. Alias A records work at the apex, which is how you point contoso.com itself at a load balancer.
Private zones
A private DNS zone (for example contoso.internal or privatelink.blob.core.windows.net) resolves only from virtual networks linked to it. VMs using Azure-provided DNS ask 168.63.129.16, which answers from every linked zone.
- Virtual network link: required for every VNet that should resolve the zone. Peering doesn’t share private zones.
- Auto-registration on a link: VMs in that VNet get A records created, updated and removed automatically. A VNet can have one registration zone, but resolution links to many zones.
- On-premises clients need Azure DNS Private Resolver (or a DNS forwarder VM) to query private zones.
Portal and CLI
Portal: DNS zones → + Create, copy the name servers from Overview, then + Record set (set Alias record set: Yes for an alias). Private DNS zones → + Create → Virtual Network Links → + Add (tick Enable auto registration if wanted).
az network dns zone create -g rg-net-lb -n contoso-shop.com
az network dns zone show -g rg-net-lb -n contoso-shop.com --query nameServers
az network dns record-set a add-record -g rg-net-lb -z contoso-shop.com -n api --ipv4-address 20.85.4.11
az network dns record-set cname set-record -g rg-net-lb -z contoso-shop.com -n shop --cname contoso.azurewebsites.net
az network dns record-set a create -g rg-net-lb -z contoso-shop.com -n www --target-resource <public-ip-id>
az network private-dns zone create -g rg-net-lb -n contoso.internal
az network private-dns link vnet create -g rg-net-lb -n link-vnet-web -z contoso.internal \
-v vnet-web --registration-enabled true
az network private-dns record-set a add-record -g rg-net-lb -z contoso.internal -n db --ipv4-address 10.40.2.10
PowerShell: New-AzDnsZone, New-AzDnsRecordSet, New-AzPrivateDnsZone, New-AzPrivateDnsVirtualNetworkLink.
Architect level Custom DNS servers on a VNet
A VNet can use custom DNS servers (VNet → DNS servers) instead of Azure-provided DNS, for example domain controllers. Those servers must forward Azure names, including privatelink zones, to 168.63.129.16, or private endpoints stop resolving. VMs pick up a DNS server change after a restart or DHCP renewal.
Real-world business scenario
Adventure Works (fictional)
- The problem
- DNS for adventure-works.com lived at a registrar only one ex-employee could log in to, and internal servers were found through hosts files copied around by hand.
- What they used
- The public zone moved to Azure DNS with RBAC and a delete lock, NS records updated at the registrar, and an alias A record at the apex pointing to the Front Door profile. A private zone aw.internal linked to every spoke, with auto-registration on the app spokes.
- Why that choice
- The team manages DNS like any other Azure resource, the apex never points at a stale IP, and VMs find each other by name without hosts files.
- The result
- DNS changes went from days to minutes, and the hosts files were deleted.
When to use it and when not to
✓ Use it when…
- Hosting public domains with Azure RBAC, locks and the CLI.
- Alias records for apex domains and resources whose IP can change.
- Private zones for internal names and every private endpoint.
✕ Think twice when…
- Expecting Azure DNS to register a new domain name for you.
- Relying on peering to share private zones. Add links.
- CNAME records at the apex.
↔ Alternatives to consider
- Azure DNS Private Resolver to resolve private zones from on-premises and forward to on-premises DNS.
- Azure Traffic Manager for DNS-based routing across regions.
- App Service Domains to buy a domain inside Azure.
Test yourself with exercises
5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner You created contoso-shop.com in Azure DNS but nobody can resolve it. What did you forget?
Model answer
Delegation. Azure gives the zone four name servers, and I have to set those as the domain's NS records at the registrar. Until then the internet keeps asking the old name servers.
Intermediate Why can't you put a CNAME on contoso.com itself, and what do you do instead?
Model answer
The apex already holds the SOA and NS records, and a CNAME can't share its name with other records. In Azure DNS I create an alias A record at @ that points to the public IP or Front Door resource. It resolves like an A record and follows the resource if its IP changes.
Experienced developer How do private DNS zones and auto-registration work across a hub and spoke?
Model answer
I create the private zone once, for example contoso.internal, and add a virtual network link from each VNet that needs to resolve it. On the spokes where VMs should register their names I turn auto-registration on. Each VNet can have only one registration zone, but it can be linked to many zones for resolution. Queries go to 168.63.129.16, which knows the linked zones.
Scenario VMs in spoke 2 can't resolve db.contoso.internal, but VMs in spoke 1 can. Fix it.
Model answer
The private zone probably has a link to spoke 1 only. I add a virtual network link from contoso.internal to spoke 2, with registration off if those VMs only need to resolve. Peering alone doesn't share private DNS zones.
Quick revision
Key points
- Public zones are hosted on 4 Azure name servers. Delegate at the registrar with NS records.
- Azure DNS hosts zones; it doesn't register domains.
- CNAME not allowed at the apex. Use an alias A record to a public IP, Front Door or Traffic Manager.
- Private zones resolve only from linked VNets. Peering doesn't share them.
- Auto-registration creates VM A records; one registration zone per VNet.
Important terminology
- DNS zone
- The DNS records for one domain, such as contoso.com, hosted as an Azure resource.
- Delegation
- Pointing a domain at Azure DNS by setting the zone's name servers as NS records at the domain registrar or parent zone.
- Record set
- All records of one type with the same name in a zone, such as every A record for www.
- Alias record
- An A, AAAA or CNAME record that references an Azure resource (public IP, Traffic Manager, Front Door, CDN) or another record set, and updates automatically.
- Private DNS zone
- A zone that resolves only from virtual networks linked to it, for internal names and private endpoints.
- Auto-registration
- A virtual network link setting that creates and removes A records for VMs in that VNet automatically.
Common mistakes
- Forgetting to update NS records at the registrar.
- Expecting a private zone to resolve from a VNet that isn't linked.
- Pointing an A record at a public IP that later changes instead of using an alias.
Exam tips
- "Make the domain resolve through Azure DNS" = update the NS records at the registrar.
- "Point contoso.com (apex) at a load balancer IP that might change" = alias A record.
- "VM names registered automatically" = private zone link with auto-registration.
Five quick revision questions
-
1.How many name servers does a public Azure DNS zone get?Show
Four.
-
2.Can you create a CNAME at the zone apex?Show
No. Use an alias record.
-
3.Which IP do VMs use for Azure-provided DNS?Show
168.63.129.16.
-
4.How many registration zones can a VNet have?Show
One.
-
5.What do you add so a VNet can resolve a private zone?Show
A virtual network link.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Configure and Troubleshoot Azure Load Balancer
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.