Azure DNS: Public and Private DNS Zones
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Day-to-day operations
-
Phase 3: Enterprise architecture
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
An Azure private DNS zone lets the servers in your virtual networks find each other by a name like app.saat.internal, so they don’t depend on IP addresses that change. Public DNS zones do the same for names the whole internet uses, such as www.example.com.
DNS problems tend to look like something else: “the app can’t connect”, “the site is down”, “storage says 403”. In Phase 4 you’ll find that half of all private endpoint trouble is DNS, so it pays to know how Azure answers a name lookup.
In the lab you’ll create a private zone, link it to vnet-saat, watch a VM register itself on its own, add some records of your own, and query a public zone straight on Azure’s name servers.
| Time | You need | Cost | By the end you can |
|---|---|---|---|
| About 45 minutes | vnet-saat, the CLI | About USD 0.05 (two DNS zones for a day; the VM uses free hours) | Create and link private DNS zones, add records, and explain why a name does or doesn’t resolve |
What it is, in one line
A DNS zone is a list of names and the addresses they point to. Private zones only answer inside the VNets linked to them, and public zones answer the whole internet.
In Simple Words
The school phone book
Nobody remembers phone numbers these days. You look up “Ravi” in your phone and it dials for you, and if Ravi changes his number, you update that one entry and anyone calling “Ravi” still gets through.
DNS is that phone book for computers. A private zone is the phone book pinned up in the staff room, which only people inside the school can read, and a public zone is the one printed for the whole city.
The staff-room copy only helps the rooms that have one, though. If a new building never gets a copy, nobody there can find Ravi, and that’s a VNet with no link to the zone.
Engineer's View
How Azure answers a name lookup
- By default every VM in a VNet uses Azure’s resolver at
168.63.129.16, unless you’ve set custom DNS servers on the VNet. - The resolver looks at the private DNS zones linked to the VM’s VNet first. If a linked zone owns the name, that zone gives the answer, even when the same name also exists on the internet.
- If not, it does an ordinary public lookup on the internet.
- A virtual network link joins a zone to a VNet, and one zone can be linked to lots of VNets (up to 1,000). With auto-registration switched on, VMs in that VNet get A records automatically when they start and lose them when they’re deleted. A VNet can only have one zone with auto-registration, but it can have many links that only resolve.
- Public zones are given four Azure name servers (
ns1-xx.azure-dns.com,.net,.org,.info), but they don’t answer the internet until you delegate the domain at your registrar by putting those NS records there.
The record types you’ll use most are A (name to IPv4), AAAA (IPv6), CNAME (name to another name, not allowed at the zone apex), TXT and MX. Each record set has a TTL, which is how long resolvers can cache the answer.
ICANN has reserved .internal for private use, so it can never clash with a real internet domain, and that’s why the course uses saat.internal. Zones are billed per zone per month, counted daily, and public and private cost the same.
How it works, step by step
This is what happens when vm-saat-l14 looks up api.saat.internal:
- The VM asks its resolver,
168.63.129.16. - The resolver sees
saat.internalis linked tovnet-saat, so it answers from that zone. apiis a CNAME pointing atapp.saat.internal, so the resolver follows it within the same zone.appis an A record for10.30.2.10, and the resolver sends back both the CNAME and the A record.- The VM caches the answer for the TTL and asks again after that.
If the VNet isn’t linked, step 2 never happens. The resolver asks the internet, which has never heard of saat.internal, and gets “no such name” back. Nothing fails loudly, the app quietly can’t find its server.
Private endpoints work the same way later on. Azure creates zones like privatelink.blob.core.windows.net, and if a VNet isn’t linked, storage names resolve to public IPs and the requests get blocked.
Hands-on lab: private names, public names
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
You’ll create a private zone with a VM that registers itself, add records and test them from the VM with Run Command, then create a public zone and query Azure’s name servers directly.
$v = Get-Content C:\azure-lab\vnet-saat.json | ConvertFrom-Json
az group create --name rg-saat-l14 --tags course=saatvedha-azure lesson=14 -o none1Create a private zone and link it with auto-registration
Run this:
az network private-dns zone create --resource-group rg-saat-l14 --name saat.internal --tags course=saatvedha-azure lesson=14 -o none
az network private-dns link vnet create --resource-group rg-saat-l14 --zone-name saat.internal --name link-vnet-saat --virtual-network $v.VnetId --registration-enabled true --tags course=saatvedha-azure lesson=14 -o none
az network private-dns link vnet list --resource-group rg-saat-l14 --zone-name saat.internal --query "[].{name:name, autoRegister:registrationEnabled, state:virtualNetworkLinkState}" -o tableYou should see something like this:
Name AutoRegister State
-------------- -------------- ---------
link-vnet-saat True Completed2Create a VM and watch it register itself
Run this (it takes about two minutes):
az vm create --resource-group rg-saat-l14 --name vm-saat-l14 --image Canonical:ubuntu-24_04-lts:server:latest --size Standard_B2ats_v2 --subnet $v.'snet-mgmt' --public-ip-address '""' --nsg '""' --admin-username azureuser --generate-ssh-keys --os-disk-size-gb 64 --tags course=saatvedha-azure lesson=14 -o none
az network private-dns record-set a list --resource-group rg-saat-l14 --zone-name saat.internal --query "[].{name:name, ip:aRecords[0].ipv4Address, auto:isAutoRegistered}" -o tableYou should see something like this:
Name Ip Auto
----------- ---------- ------
vm-saat-l14 10.30.10.4 TrueYou didn’t make that record. Azure created it when the VM’s network card came up in a VNet with an auto-registration link.
3Add your own records
Run this:
az network private-dns record-set a add-record --resource-group rg-saat-l14 --zone-name saat.internal --record-set-name app --ipv4-address 10.30.2.10 -o none
az network private-dns record-set a add-record --resource-group rg-saat-l14 --zone-name saat.internal --record-set-name db --ipv4-address 10.30.3.10 -o none
az network private-dns record-set cname set-record --resource-group rg-saat-l14 --zone-name saat.internal --record-set-name api --cname app.saat.internal -o none
az network private-dns record-set list --resource-group rg-saat-l14 --zone-name saat.internal --query "[].{name:name, type:type, ttl:ttl}" -o tableYou should see something like this:
Name Type TTL
----------- ---------------------------------- -----
@ Microsoft.Network/privateDnsZones/SOA 3600
api Microsoft.Network/privateDnsZones/CNAME 3600
app Microsoft.Network/privateDnsZones/A 3600
db Microsoft.Network/privateDnsZones/A 3600
vm-saat-l14 Microsoft.Network/privateDnsZones/A 10Records you add get a TTL of 3600 seconds (one hour) by default, and auto-registered ones get 10 seconds because VMs come and go. If you might change a record during a migration, lower its TTL the day before.
4Look the names up from inside the VNet
Run this:
az vm run-command invoke --resource-group rg-saat-l14 --name vm-saat-l14 --command-id RunShellScript --scripts "getent hosts app.saat.internal api.saat.internal vm-saat-l14.saat.internal; resolvectl dns eth0" --query "value[0].message" -o tsvYou should see something like this:
Enable succeeded:
[stdout]
10.30.2.10 app.saat.internal
10.30.2.10 app.saat.internal api.saat.internal
10.30.10.4 vm-saat-l14.saat.internal
Link 2 (eth0): 168.63.129.16
[stderr]
getent hosts takes the same lookup path that applications use. The CNAME appears as an alias of app.saat.internal, and the last line confirms the VM is asking Azure’s resolver, 168.63.129.16.
5Create a public zone and ask Azure’s name servers
Run this on your laptop:
$zone = 'saatlab' + (Get-Random -Maximum 99999) + '.com'
az network dns zone create --resource-group rg-saat-l14 --name $zone --tags course=saatvedha-azure lesson=14 -o none
az network dns record-set a add-record --resource-group rg-saat-l14 --zone-name $zone --record-set-name www --ipv4-address 203.0.113.10 -o none
$ns = az network dns zone show --resource-group rg-saat-l14 --name $zone --query "nameServers[0]" -o tsv
Resolve-DnsName -Name "www.$zone" -Type A -Server $ns.TrimEnd('.') | Select-Object Name, IPAddressYou should see something like this:
Name IPAddress
---- ---------
www.saatlab41827.com 203.0.113.10203.0.113.10 is a documentation address, so it’s safe for labs. Azure’s name server answered because you asked it directly, and in “Break It” you’ll see why the rest of the internet doesn’t know this name yet.

✅ Checkpoint: Your private zone answers inside vnet-saat (including the auto-registered VM), and Azure’s public name server answers for www in your public zone.
Break It, Then Fix It
Both of these are “nothing’s wrong, it just won’t resolve” problems, and on a busy day those are the hardest kind.
1Break it: a public zone nobody has delegated
Run this on your laptop, this time without naming a server:
Resolve-DnsName -Name "www.$zone" -Type AYou’ll get an error like this:
Resolve-DnsName : www.saatlab41827.com : DNS name does not exist
At line:1 char:1
+ Resolve-DnsName -Name "www.$zone" -Type A
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (www.saatlab41827.com:String) [Resolve-DnsName], Win32Exception
+ FullyQualifiedErrorId : DNS_ERROR_RCODE_NAME_ERROR,Microsoft.DnsClient.Commands.ResolveDnsNameYour normal resolver asks the .com servers, and nobody has told them Azure hosts this domain. Creating a zone in Azure doesn’t publish it anywhere.
For a real domain, the fix is to copy the four name servers and set them as the NS records at your registrar:
az network dns zone show --resource-group rg-saat-l14 --name $zone --query nameServers -o tsvYou should see something like this:
ns1-07.azure-dns.com.
ns2-07.azure-dns.net.
ns3-07.azure-dns.org.
ns4-07.azure-dns.info.You don’t own this made-up domain, so this is as far as you go. With a real domain, delegation can take anything from minutes to a couple of days, depending on the TTLs at the registrar and the TLD.
2Break it: remove the VNet link
Delete the link, then look the names up again:
az network private-dns link vnet delete --resource-group rg-saat-l14 --zone-name saat.internal --name link-vnet-saat --yes
Start-Sleep -Seconds 30
az vm run-command invoke --resource-group rg-saat-l14 --name vm-saat-l14 --command-id RunShellScript --scripts "getent hosts app.saat.internal || echo NOT-FOUND" --query "value[0].message" -o tsvYou should see something like this:
Enable succeeded:
[stdout]
NOT-FOUND
[stderr]
The zone and its records are still there, but vnet-saat has lost its copy of the phone book, so Azure’s resolver asks the internet and comes back empty. At work you see this when someone creates a new spoke VNet and nobody links the shared private zones to it.
To fix it, link the zone again (resolution only is fine this time) and test:
az network private-dns link vnet create --resource-group rg-saat-l14 --zone-name saat.internal --name link-vnet-saat --virtual-network $v.VnetId --registration-enabled false -o none
az vm run-command invoke --resource-group rg-saat-l14 --name vm-saat-l14 --command-id RunShellScript --scripts "getent hosts app.saat.internal || echo NOT-FOUND" --query "value[0].message" -o tsvYou should see something like this:
Enable succeeded:
[stdout]
10.30.2.10 app.saat.internal
[stderr]

3Clean up
Run this:
az group delete --name rg-saat-l14 --yes
C:\azure-lab\Find-LabResources.ps1 -Lesson 14You should see this:
Nothing tagged course=saatvedha-azure is left.✅ Checkpoint: Both problems reproduced and understood, and nothing from Lesson 14 is left.
This happened at work
The 24-hour TTL on migration night
A pharmacy chain was moving its stock system from an old VM to a new one in Azure. On paper it was easy: at 10 p.m., change stock.corp.internal in the private DNS zone from the old IP to the new one.
The trouble was the record’s TTL, which was 86,400 seconds, a full day, set years before “to reduce DNS traffic”. After the change, roughly half the store servers carried on with the cached old IP and wrote sales to the old system all night, while the other half used the new one. Next morning the stock counts were off in 300 stores, and it took two days of reconciliation to sort out.
What they changed: their migration checklist now drops the TTL to 60 seconds at least one full old-TTL period before cutover and puts it back up afterwards. The old system goes read-only at cutover, so any client with a stale answer fails loudly instead of writing to the wrong place. Internal app records now get a normal TTL of one hour.
Common mistakes and troubleshooting
| Mistake | What you see | What to do |
|---|---|---|
| New VNet not linked to the private zone | Names don’t resolve only in that VNet | Link each VNet that needs the zone, and check the links whenever you build a network. |
| Expecting a new public zone to work at once | DNS name does not exist | Delegate it at the registrar using the four Azure NS records. |
| Long TTL during a change | Some clients keep the old IP for hours | Lower the TTL well ahead of a change and raise it again afterwards. |
| CNAME at the zone apex | The record can’t be created | Use an A record or an alias record at the apex instead. |
| Two zones with auto-registration on one VNet | The second link is refused | A VNet gets one auto-registration zone, and its other links only resolve. |
| Custom DNS servers on the VNet that don’t forward | Private zones stop resolving | Forward unknown names to 168.63.129.16, or use Azure DNS Private Resolver. |
Interview questions
Click a question to open it. Each one is worded the way an interviewer would put it, and underneath you’ll find why they ask it and one way you could answer in your own words.
Fresher level
1. What is the difference between a public and a private DNS zone in Azure?
Why they ask this: A basic concept check.
How you might answer: A public zone answers queries from anywhere on the internet once the domain’s delegated to Azure’s name servers. A private zone only answers for the VNets linked to it, so internal names don’t leak out.
2. What does 168.63.129.16 do for DNS?
Why they ask this: They want to see you know the Azure resolver.
How you might answer: It’s the DNS resolver Azure provides, and every VM uses it unless you change that. It answers from linked private zones first and then resolves public names on the internet.
3. What is auto-registration in a private DNS zone?
Why they ask this: A feature check with a useful limit.
How you might answer: If a VNet link has auto-registration switched on, VMs in that VNet get A records in the zone automatically and lose them when they’re deleted. One VNet can only have one zone with auto-registration.
2–5 years experience
4. An app in a new VNet can’t resolve db.corp.internal, but it works everywhere else. What do you check?
Why they ask this: They want the most likely cause first.
How you might answer: First I’d check whether the private zone is linked to the new VNet, because that’s usually it. Then I’d see whether the VNet uses custom DNS servers that don’t forward to Azure. I’d test with getent hosts or nslookup from a VM in that VNet.
5. How do you plan a DNS change during a migration?
Why they ask this: They’re checking TTL awareness.
How you might answer: I’d drop the record’s TTL to about a minute at least one full old-TTL period before the change, so caches run out quickly, and put it back up once the cutover’s stable. I’d also make the old system read-only, so any client with a stale answer fails clearly.
6. You created a public zone in Azure but the domain doesn’t resolve on the internet. Why?
Why they ask this: They want delegation understanding.
How you might answer: It hasn’t been delegated yet, so the registrar still points at the old name servers. I’d copy the four Azure name servers from the zone, set them as NS records at the registrar and then wait out the TLD’s TTLs.
Senior level
7. How would you design DNS for a hub-and-spoke network with on-premises servers?
Why they ask this: They want a scalable, hybrid DNS design.
How you might answer: I’d keep the private zones, privatelink zones included, in a central subscription and link them to the hub and every spoke. Azure DNS Private Resolver in the hub takes on-premises lookups for Azure names through an inbound endpoint, and sends Azure workloads’ lookups for on-premises names to the company DNS servers through an outbound endpoint. The spokes use Azure DNS, and a policy or pipeline step links each new spoke to the zones automatically.
8. What are the risks of every team creating their own private DNS zones?
Why they ask this: They’re testing governance thinking.
How you might answer: You end up with duplicate zones for the same name, privatelink zones especially, and the answer then depends on which VNet is asking. Links get forgotten and nobody knows who owns which record. I’d centralise the shared zones, let teams write their own records, and use Azure Policy to block duplicate privatelink zones.
9. Why is .internal a good choice for private zones?
Why they ask this: They want awareness of naming risks.
How you might answer: ICANN reserved .internal for private use, so it’ll never turn into a public top-level domain and clash with real internet names. Made-up suffixes like .corp or .local have caused trouble before.
Quick quiz
Q1. Which VNets can resolve names in a private DNS zone?
- Every VNet in the subscription
- Only VNets linked to the zone
- Only the VNet in the same resource group
- Any VNet in the region
Show answer
B — Only linked VNets get answers from the zone.
Q2. What is the default DNS resolver address for Azure VMs?
- 8.8.8.8
- 10.30.0.1
- 168.63.129.16
- 127.0.0.53 only
Show answer
C — 168.63.129.16 is the Azure-provided resolver.
Q3. A new public zone answers on Azure’s name servers but not on the internet. Why?
- TTL too long
- The domain isn’t delegated at the registrar
- Private zone conflict
- Wrong record type
Show answer
B — You must set Azure’s NS records at the registrar.
Q4. How many private zones with auto-registration can one VNet have?
- One
- Two
- Ten
- Unlimited
Show answer
A — Only one zone can auto-register a VNet’s VMs.
Q5. Why lower a TTL before a migration?
- To save money
- So caches expire quickly and clients pick up the new IP
- To make DNS more secure
- Azure requires it
Show answer
B — Short TTLs mean old answers don’t live long in caches.
Quick recap
You can make names work inside Azure now, and you know the two quiet reasons they stop working.
- Private zones answer only in linked VNets; public zones answer the internet after delegation.
- VMs ask 168.63.129.16, which checks linked private zones first.
- Auto-registration adds VM records for you; one such zone per VNet.
- Lower TTLs before a change; CNAMEs aren’t allowed at the apex.
- Missing VNet links cause many private endpoint and app problems later.
Next lesson
Lesson 15: Create your first Azure VM (Linux) → You’ll build a proper Linux VM, connect to it safely and find out what each choice in az vm create means.
Further reading: Azure private DNS zone
Want to go deeper into Azure private DNS zone? See Microsoft’s What is an Azure private DNS zone? and Delegate a domain to Azure DNS. You can also see the full plan for this course on the Azure Cloud Administration course page.
