Create a public DNS zone and records
In this task you'll create a public DNS zone and add a record.
DNS turns names such as www.sskaiser.example into IP addresses. Azure DNS can host your domain's records, so you manage them in the portal next to the resources they point at.
You create a zone named after your domain, add records to it, and then tell your domain registrar to use Azure's name servers. That last step is called delegation.
Example. Larkfield Group moves larkfield.example to Azure DNS. Its www record points at the web server's public IP, and the team changes records in the portal instead of logging in to the registrar.
Costs money. A DNS zone has a small monthly charge (around 50 US cents) from the moment it exists, plus a tiny fee per million lookups. Only create one if you're happy to pay that; otherwise follow along by looking at the screens.
Before you start
You need: DNS Zone Contributor or Contributor. Time: 10 minutes.
Where to look
- Home
- DNS zones
- + Create
Steps
- Open DNS zones and select + Create.
- Choose rg-portal-practice and enter a name such as practice-yourinitials.example.Names ending in .example can't be delegated, so the zone won't answer for the real internet. That's fine for practice.
- Select Review + create, then Create, and open the zone.
- Look at the four Name server values on Overview.For a real domain, you'd copy these to your registrar to delegate the domain to Azure.
- Open Record sets (or select + Record set on Overview) and add a record. Enter www, choose type A, a TTL of 1 hour and the IP address 203.0.113.10, then Add or OK.
- Test it from Cloud Shell by asking one of the zone's own name servers:Type
nslookup www.practice-yourinitials.examplefollowed by the first name server, such asns1-01.azure-dns.com.
Commands
# Create the zone and one A record
az network dns zone create --resource-group rg-portal-practice --name practice-yourinitials.example
az network dns record-set a add-record --resource-group rg-portal-practice \
--zone-name practice-yourinitials.example --record-set-name www --ipv4-address 203.0.113.10
# Which name servers host the zone?
az network dns zone show --resource-group rg-portal-practice \
--name practice-yourinitials.example --query nameServers
Watch out for
- Cost
- Charged per zone per month, plus per million queries. A handful of zones costs very little, but the charge starts as soon as the zone exists.
- Security
- Anyone who can change your zone can send your visitors anywhere. Give DNS Zone Contributor only to the people who need it, and consider a delete lock on live zones.
- Common mistakes
- Forgetting to delegate at the registrar, so the internet never asks Azure. Setting a very long TTL before a planned change, which makes the old answer linger.
Clean up
- Resource groups
- rg-portal-practice
- Delete resource group
You've finished the networking section: delete the resource group. It removes the networks, the NSG, the peering and the DNS zone.
Words to know
- DNS zone
- The set of records for one domain, such as sskaiser.example.
- A record
- A record that points a name at an IPv4 address.
- Name servers
- The servers that answer questions about your zone. Azure gives you four.
- TTL
- Time to live: how long other servers may remember an answer before asking again.
Tick off each step and track your progress in the guide.
Open this task in Azure Portal, Hands On