Introduction
Azure DNS is a reliable, scalable, and secure DNS service that hosts your domain names and provides fast name resolution using Microsoft global network infrastructure.
Create a DNS Zone
Follow these steps to create a DNS zone in Azure Portal:
1. Sign in to Azure Portal.
2. Navigate to All services > DNS zones.
3. Click + Create.
4. Provide the Subscription, Resource group, and Name of your domain.
5. Review and click Create.
az network dns zone create \
--resource-group MyResourceGroup \
--name example.com
resource "azurerm_dns_zone" "example" {
name = "example.com"
resource_group_name = azurerm_resource_group.rg.name
}
Record Types
Type | Description |
---|---|
A | Maps a domain to an IPv4 address. |
AAAA | Maps a domain to an IPv6 address. |
CNAME | Alias of another domain name. |
MX | Mail exchange servers. |
TXT | Arbitrary text, often for verification. |
SRV | Service location records. |
Example of adding an A record:
az network dns record-set a add-record \
--resource-group MyResourceGroup \
--zone-name example.com \
--record-set-name www \
--ipv4-address 20.30.40.50
resource "azurerm_dns_a_record" "www" {
name = "www"
zone_name = azurerm_dns_zone.example.name
resource_group_name = azurerm_resource_group.rg.name
ttl = 300
records = ["20.30.40.50"]
}
Best Practices
- Use TTL values appropriate to your change frequency.
- Separate public and private DNS zones.
- Implement Azure Private DNS for internal name resolution.
- Enable DNSSEC where applicable.
- Monitor DNS queries with Azure Monitor logs.
FAQ
Can I use custom DNS servers with Azure VNet?
Yes. You can configure VNet to use Azure DNS, your own DNS servers, or a combination of both.
Is Azure DNS geo-redundant?
Yes. Azure DNS is globally distributed and offers high availability out of the box.