Azure DNS is a fully managed DNS hosting service that provides high availability, scalability, and security for your domains. With Azure DNS, you can manage your DNS records using Azure’s global network of DNS servers, which are geographically distributed for optimal performance.

To use Azure DNS, you must have an Azure account. If you don’t have one, you can sign up for a free trial at https://azure.com/free.

Let’s get started!

Step 1: Create a DNS zone

The first step in using Azure DNS is to create a DNS zone. A DNS zone is a container for your DNS records, and it represents a domain or a subdomain.

To create a DNS zone using Azure CLI, you can use the following command:

az network dns zone create -g RESOURCE_GROUP_NAME -n ZONE_NAME

Replace RESOURCE_GROUP_NAME with the name of the resource group where you want to create the DNS zone, and replace ZONE_NAME with the name of the DNS zone you want to create.

For example, to create a DNS zone named example.com in a resource group named my-resource-group, you can use the following command:

az network dns zone create -g my-resource-group -n example.com

Step 2: Add DNS records

Once you have created a DNS zone, you can add DNS records to it. DNS records are used to map domain names to IP addresses, or to define other types of DNS resource records.

To add a DNS record using Azure CLI, you can use the following command:

az network dns record-set <action> -g RESOURCE_GROUP_NAME -z ZONE_NAME -n RECORD_SET_NAME [options]

The <action> parameter can be one of the following values, depending on the type of DNS record you want to create:

  • A: Creates an A record that maps a domain name to an IPv4 address.
  • AAAA: Creates an AAAA record that maps a domain name to an IPv6 address.
  • CNAME: Creates a CNAME record that maps a domain name to another domain name.
  • MX: Creates an MX record that specifies the mail server for a domain.
  • NS: Creates an NS record that specifies the authoritative name servers for a domain.
  • PTR: Creates a PTR record that maps an IP address to a domain name.
  • SOA: Creates an SOA record that specifies the start of authority for a domain.
  • SRV: Creates an SRV record that specifies the location of a service.
  • TXT: Creates a TXT record that contains arbitrary text data.

Replace RESOURCE_GROUP_NAME, ZONE_NAME, RECORD_SET_NAME, and [options] with the appropriate values for your DNS record.

For example, to create an A record that maps the www subdomain of example.com to the IP address 10.0.0.1, you can use the following command:

az network dns record-set a add-record -g my-resource-group -z example.com -n www --ipv4-address 10.0.0.1

Step 3: Manage DNS settings

In addition to creating DNS zones and adding DNS records, you can also manage DNS settings using Azure CLI.

To manage DNS settings using Azure CLI, you can use the following commands:

  • az network dns zone show: Shows the details of a DNS zone.
  • az network dns zone delete: Deletes a DNS zone.
  • az network dns record-set show:…
  • az network dns record-set delete: Deletes a DNS record set.
  • az network dns record-set list: Lists all DNS record sets in a DNS zone.
  • az network dns record-set update: Updates a DNS record set.
  • az network dns record-set remove-record: Removes a DNS record from a DNS record set.

For example, to list all DNS record sets in the example.com DNS zone, you can use the following command:

az network dns record-set list -g my-resource-group -z example.com

This will return a list of all DNS record sets in the example.com DNS zone, along with their type and other details.

Conclusion

In this tutorial, we covered how to use Azure DNS to create a DNS zone, add DNS records, and manage DNS settings using Azure CLI commands. With Azure DNS, you can easily manage your DNS records using Azure’s global network of DNS servers, which are highly available, scalable, and secure. If you have any questions or feedback, please feel free to reach out to the Azure support team or consult the Azure documentation for further guidance.