Get Started with Azure DNS using PowerShell

This article walks you through the steps to create your first DNS zone and record using Azure PowerShell. You can also perform these steps using the Azure portal or the cross-platform Azure CLI. Azure DNS also supports creating a private domains. For step-by-step instructions about how create your first private DNS zone and record, see Get started with Azure DNS private zones using PowerShell.

A DNS zone is used to host the DNS records for a particular domain. To start hosting your domain in Azure DNS, you need to create a DNS zone for that domain name. Each DNS record for your domain is then created inside this DNS zone. Finally, to publish your DNS zone to the Internet, you need to configure the name servers for the domain. Each of these steps is described below.

These instructions assume you have already installed and signed in to Azure PowerShell. For help, see How to manage DNS zones using PowerShell.

Create the resource group

Before creating the DNS zone, a resource group is created to contain the DNS Zone. The following shows the command.

New-AzureRMResourceGroup -name MyResourceGroup -location "westus"

Create a DNS zone

A DNS zone is created by using the New-AzureRmDnsZone cmdlet. The following example creates a DNS zone called in the resource group called MyResourceGroup. Use the example to create a DNS zone, substituting the values for your own.

New-AzureRmDnsZone -Name -ResourceGroupName MyResourceGroup

Azure DNS now also supports private DNS zones (currently in public preview). To learn more about private DNS zones, see Using Azure DNS for private domains. For an example of how to create a private DNS zone, see Get started with Azure DNS private zones using PowerShell.

Create a DNS record

You create record sets by using the New-AzureRmDnsRecordSet cmdlet. The following example creates a record with the relative name "www" in the DNS Zone "", in resource group "MyResourceGroup". The fully-qualified name of the record set is "". The record type is "A", with IP address "", and the TTL is 3600 seconds.

New-AzureRmDnsRecordSet -Name www -RecordType A -ZoneName -ResourceGroupName MyResourceGroup -Ttl 3600 -DnsRecords (New-AzureRmDnsRecordConfig -IPv4Address "")

For other record types, for record sets with more than one record, and to modify existing records, see Manage DNS records and record sets using Azure PowerShell.

View records

To list the DNS records in your zone, use:

Get-AzureRmDnsRecordSet -ZoneName -ResourceGroupName MyResourceGroup

Update name servers

Once you are satisfied that your DNS zone and records have been set up correctly, you need to configure your domain name to use the Azure DNS name servers. This enables other users on the Internet to find your DNS records.

The name servers for your zone are given by the Get-AzureRmDnsZone cmdlet:

Get-AzureRmDnsZone -Name -ResourceGroupName MyResourceGroup

Name                  :
ResourceGroupName     : myresourcegroup
Etag                  : 00000003-0000-0000-b40d-0996b97ed101
Tags                  : {}
NameServers           : {,,,}
NumberOfRecordSets    : 3
MaxNumberOfRecordSets : 5000

These name servers should be configured with the domain name registrar (where you purchased the domain name). Your registrar will offer the option to set up the name servers for the domain. For more information, see Delegate your domain to Azure DNS.

Delete all resources

To delete all resources created in this article, take the following step:

Remove-AzureRMResourceGroup -Name MyResourceGroup

Next steps

To learn more about Azure DNS, see Azure DNS overview.

To learn more about managing DNS zones in Azure DNS, see Manage DNS zones in Azure DNS using PowerShell.

To learn more about managing DNS records in Azure DNS, see Manage DNS records and record sets in Azure DNS using PowerShell.