Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 38 of 47
❮Prev Next❯

Azure DNS: Public and Private Zones and Records

Module 4: Networking ⏱ 11 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    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 needed

    Exam 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.

    Azure portal: Public DNS zone with an alias record, and a private zone link Host a public zone with an alias record and link a private zone.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Search for <strong>DNS zones</strong>.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Search for DNS zones.
    2. Type dns zones in the search bar and pick DNS zones under Services.
    3. Host contoso-shop.com. The zone name is the domain you own.
    4. Azure gives the zone four name servers. Put them as the NS records at your domain registrar to delegate the domain to Azure DNS.
    5. 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.
    6. Now a private DNS zone, contoso.internal. It answers only VNets linked to it. Open Virtual Network Links → + Add.
    7. Link vnet-web and enable auto registration: VMs there get A records created and removed automatically. A VNet can have only one registration zone.
    8. 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.

    😟 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
    🛠️ Solved with: Azure DNS

    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

    TypeExampleNotes
    A / AAAAwww → 20.85.4.10IPv4 / IPv6 address
    CNAMEshop → contoso.azurewebsites.netNot at the apex, and alone on its name
    MX@ → mail.contoso.com (priority 10)Mail
    TXT@ → “v=spf1 …”Verification, SPF
    SRV, CAA, PTR, NSServices, 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

    Travel

    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.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    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.

    Question 1

    Question 1 of 5

    You create a public DNS zone named contoso.com in Azure DNS and add records. Internet users still receive answers from the previous DNS provider. What should you do?

    Question 2

    Question 2 of 5

    The zone apex contoso.com must resolve to the public IP address of a load balancer. The record must update automatically if the IP address changes. What should you create?

    Question 3

    Question 3 of 5

    A private DNS zone named contoso.internal is linked to VNet1 with auto-registration enabled. VNet2 is peered with VNet1. VMs in VNet2 cannot resolve names in contoso.internal. What should you do?

    Question 4

    Question 4 of 5

    You need the names of VMs in VNet1 to be added to and removed from a private DNS zone automatically. VNet1 already has auto-registration enabled for a private zone named corp.internal. What happens if you link VNet1 to a second private zone named apps.internal with auto-registration enabled?

    Question 5

    Question 5 of 5 · Select 2

    Which two record types can you create as alias record sets in an Azure public DNS zone? Each correct answer presents a complete solution.

    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. 1.How many name servers does a public Azure DNS zone get?Show

      Four.

    2. 2.Can you create a CNAME at the zone apex?Show

      No. Use an alias record.

    3. 3.Which IP do VMs use for Azure-provided DNS?Show

      168.63.129.16.

    4. 4.How many registration zones can a VNet have?Show

      One.

    5. 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

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.