Azure DNS
Public zones · delegation · record sets · alias records · private zones · RBAC and locks
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Public zones and delegation
- Azure DNS hosts zones on Microsoft's global name servers. It doesn't sell domains: buy one from App Service domains or a registrar.
- The zone service is global. The resource group location doesn't matter.
- A zone name must be unique within a resource group. The same name can exist in another resource group or subscription, but each copy gets different name servers, and only one set can be set at the registrar.
- You needn't own a domain to create the zone, but you must own it to delegate.
- Delegation steps: create the zone, create the records, get the four Azure name servers, set the NS records at the registrar, then verify. Use all four name servers, with the trailing period. Vanity name servers aren't supported.
- Verify with
nslookup -type=SOA contoso.xyz. Wait at least 10 minutes. - Creating the zone doesn't make it authoritative: the registrar's NS records do.
- Azure DNS creates the NS record set (4 servers) and the SOA record at the zone apex. You can't delete the apex NS record set, and you can't remove or change the Azure name servers. You can add NS entries (co-hosting) and change TTL and metadata.
Record sets
- Types: A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT. SPF must be created as TXT: the SPF type isn't supported.
- A record set is the records with the same name and type. TTL is set per record set, from 1 to 2,147,483,647 seconds. Names are relative (
wwwin contoso.com). The apex is@. - A CNAME record set can't coexist with another record set of the same name, and can't be created at the apex (the apex already has NS and SOA). CNAME and SOA record sets hold one record.
- Wildcard record sets (
*) work for all types except NS and SOA. - TXT strings are up to 255 characters each, 4,096 in total per record set.
- Tags work on zones. Use metadata on record sets.
Alias record sets
- Alias record sets can be type A, AAAA or CNAME. They point to an Azure resource or another record set in the zone: a Standard SKU public IP, a Traffic Manager profile, a CDN endpoint, a Front Door endpoint, or a record set in the same zone.
- They update automatically when the IP changes or the resource is deleted, so there are no dangling records. They can be used at the zone apex.
- The
Microsoft.Networkresource provider must be registered (in both subscriptions if they differ). Limit: 50 alias records per resource.
Private DNS zones
- A private zone resolves names inside vnets. The zone is a global resource, not tied to a region or one vnet. A vnet must be linked to the zone to resolve it.
- Autoregistration on a virtual network link creates, updates and deletes A records for VMs in that vnet. A vnet can be linked with autoregistration to only one private zone. Multiple vnets can link to one zone.
- Cross-vnet resolution with a private zone doesn't need peering.
- Reverse DNS works only for private IP space in the linked vnet. Split-horizon (the same name public and private) is supported. Don't use
.local. - Resolving private zone records from on-premises uses Azure DNS Private Resolver with conditional forwarding.
- Private zones support A, AAAA, CNAME, MX, PTR, SOA, SRV and TXT.
- Azure-provided DNS only resolves names inside one vnet. Cross-vnet name resolution needs custom DNS or Private DNS.
RBAC and locks
| Tool | What it does |
|---|---|
| DNS Zone Contributor | Manages public DNS resources (Microsoft.Network/DNSZones). It doesn't grant permissions to private DNS zones. On a resource group it gives full control of the zones there without letting the user create or stop VMs |
| Private DNS Zone Contributor | Manages private DNS resources (Microsoft.Network/privateDnsZones) |
| Custom role | Finer control, for example CNAME-only (Microsoft.Network/dnsZones/CNAME/* plus Microsoft.Network/dnsZones/read). Create with az role definition create or New-AzRoleDefinition -InputFile, not in the portal. A role that blocks record set deletion but allows update isn't an effective control: records can be removed from the set |
| ReadOnly lock | On a zone: no new record sets, and no changes or deletes to existing ones. Locks apply to every user and role |
| CanNotDelete lock | On a record set it isn't an effective control (records can still be removed). To block deleting the zone, put CanNotDelete on the SOA record set (<zone>/@); other record sets can still change. Record-set locks can only be created with Azure PowerShell |
Both roles can be assigned at subscription, resource group, zone or record set scope. Deleting a zone deletes all its record sets and can't be undone.
CLI and PowerShell
| Task | Command |
|---|---|
| Create a public zone | az network dns zone create -g MyResourceGroup -n contoso.xyz |
| Add an A record | az network dns record-set a add-record -g MyResourceGroup -z contoso.xyz -n www -a 10.10.10.10 |
| List records | az network dns record-set list -g MyResourceGroup -z contoso.xyz |
| Show name servers | az network dns record-set ns show --resource-group MyResourceGroup --zone-name contoso.xyz --name @ |
| Test before delegation | nslookup www.contoso.xyz <azure name server> |
| Create a private zone | az network private-dns zone create -g test-rg --name "privatelink.azurewebsites.net" |
| Link a vnet (true for autoregistration) | az network private-dns link vnet create -g rg --zone-name <zone> --name dns-link --virtual-network vnet-1 --registration-enabled false |
| Assign DNS Zone Contributor | az role assignment create --assignee "<user>" --role "DNS Zone Contributor" --resource-group "<rg>" |
| PowerShell A record set | $Records = @(); $Records += New-AzDnsRecordConfig -IPv4Address 1.2.3.4; New-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -TTL 3600 -ZoneName "myzone.com" -DnsRecords $Records |
| PowerShell alias record set | New-AzDnsRecordSet ... -TargetResourceId <resource ID>. for a Traffic Manager linked record set use -TrafficManagerProfileId instead |
With New-AzDnsRecordSet, an existing record set with the same name and type needs -Overwrite. SOA records are created automatically and can't be created manually.
Limits
| Item | Value |
|---|---|
| Public DNS zones per subscription | 250 |
| Record sets per public zone | 10,000 |
| Records per record set (public) | 20 |
| TXT records per record set (public) | 400 |
| Private DNS zones per subscription | 1,000 |
| Record sets per private zone | 25,000 |
| Vnet links per private zone | 1,000 (100 with autoregistration) |
| Name servers per delegated zone | 4 |
Exam Tips
Tick each tip once you can answer it without looking.
“Host contoso.com in Azure DNS so the internet resolves it” → Create the zone, then set the registrar's NS records to the Azure name servers. Trap: creating only the A records.
“How many Azure name servers to set at the registrar” → All four assigned to the zone. Trap: any one of them.
“Verify delegation” → nslookup -type=SOA <domain> (allow 10 minutes or more). Trap: pinging the zone.
“Buy a domain in Azure DNS” → Not supported: use App Service domains or a registrar. Trap: a Register option in Azure DNS.
“CNAME for contoso.com (the apex) to a Traffic Manager profile” → An alias A or AAAA record set. Trap: a CNAME at @ is not allowed.
“CNAME www and A www in the same zone” → Not allowed: a CNAME cannot coexist with another record set of that name. Trap: assuming both can exist.
“Prevent a dangling DNS record when a public IP is deleted or changes” → An alias record set that points to the public IP resource. Trap: an A record with a low TTL.
“Alias record target public IP SKU” → Standard. Trap: Basic.
“Record types an alias record set can use” → A, AAAA and CNAME. Trap: MX or TXT.
“Alias record creation fails” → Register the Microsoft.Network resource provider (both subscriptions if different). Trap: missing Contributor on the DNS zone.
“SPF record” → Create it as a TXT record. Trap: the SPF type is not supported.
“Delete the zone's apex NS record set” → Not possible: it is removed only with the zone. Trap: deleting and recreating it.
“Same zone name in two resource groups” → Allowed, but each gets different name servers; only one set goes to the registrar. Trap: being blocked.
“VMs in a vnet should auto-register hostnames in contoso.internal” → A private DNS zone plus a vnet link with autoregistration enabled. Trap: a public zone.
“A vnet needs autoregistration into two private zones” → Not allowed: one autoregistration zone per vnet. Trap: peering does not change that.
“Two vnets in different regions resolve the same private zone” → Link both vnets to the zone; no peering needed. Trap: peering is not required.
“Resolve private zone records from on-premises” → Azure DNS Private Resolver with conditional forwarding. Trap: a VPN alone.
“Admin must manage public DNS zones in a resource group but not VMs” → DNS Zone Contributor on the resource group. Trap: it does not cover private zones: use Private DNS Zone Contributor there.
“Freeze a zone so records can't be added, changed or deleted” → ReadOnly lock on the zone. Trap: a CanNotDelete lock on a record set: records can still be removed.
“Stop anyone deleting the zone itself” → CanNotDelete lock on the SOA record set (PowerShell only). Trap: a lock on another record set.
Sources
- DNS zones and records overview
- Tutorial: host your domain in Azure DNS
- Azure Private DNS
- Alias records overview
- Quickstart: create a DNS zone and record (CLI)
- Protecting DNS zones and records
- Protecting private DNS zones and records
- New-AzDnsRecordSet
- Azure subscription and service limits
Checked against Microsoft Learn on November 13, 2026.