On Tuesday at Ignite Microsoft announced a number of new Azure services, one of which was Azure DNS. The ability to host your DNS zones has been a feature of cloud providers like AWS for some time now, so it's good to see Microsoft adding in this essential component for providing web services.

Before venturing into using Azure DNS there are a few things to be aware of, firstly it's not (yet) available in the management portal, you can use it via PowerShell, .Net SDK or Resource Manger REST API's. Secondly you have to sign up to the preview before you can use it.

There is a a step by step guide to setting up and using Azure DNS through PowerShell on the MSDN site here so I won't go into every detail of how to get started with this, however there are a few gotchas I came across.

Registering for Azure DNS

First off, you need to the latest version of the PowerShell cmdlets. If you find you are getting errors when trying to run the "Register-AzureProvider" cmdlet it likely means your not using the Azure PowerShell cmdlets that were released on Monday.

Once you've run through the first steps in the guide and got to the point where you register for the preview, you will sit in a pending state for some time before you can use the preview. To find out if your request to use the preview has been approved you can run the following command:

Get-AzureProvider -ProviderNamespace Microsoft.Network| Get-AzureProviderFeature -FeatureName AzureDNSPreview

Once youre registration changes to "Registered" you then need to run the command to register the provider again, otherwise you will see an erro.

Register-AzureProvider -ProviderNamespace Microsoft.Network  

`

Creating Zones and Records

Once your registered you can go ahead and create a zone with a single PowerShell command

New-AzureDnsZone -Name samcogan.com -ResourceGroupName ResourceGroup1  

At this point you have an empty zone, which you need to add records to.

However, to add a record you first need to create a Record Set. A record set contains the name and type of the record you want to create, but does not directly have an IP address. IP addresses are added as records to a record set. In this way you can have multiple IP's per record.

$rs=New-AzureDnsRecordSet -Name "www" -RecordType "A" -ZoneName "samcogan.com" -ResourceGroupNam
e "resourcegroup1" -Ttl 60  

It should be noted that at this point, the record set only exists in our PowerShell session, it has not been commited to the zone yet.

Now we have a record set, we can add in the require IP records.

Add-AzureDnsRecordConfig -RecordSet $rs -Ipv4Address 23.102.21.198

Add-AzureDnsRecordConfig -RecordSet $rs -Ipv4Address 23.102.21.199  

Now that's done, the recordset needs to be committed to Azure to complete the creation.

Set-AzureDnsRecordSet -RecordSet $rs  

We now have a new zone, with a www A record and we can go ahead and change zone registration at the registrar to complete the change.

Supported Records

Azure DNS Supports the following record types:

  • A
  • AAAA
  • CNAME
  • MX
  • NS
  • SRV
  • TXT

You can also modify SOA records for the zone apex, but not add or remove them.

Pricing

Pricing for Azure DNS is based both on the number of zones and the amount of queries. During the preview pricing is reduced by 50% to around £0.16 per zone and £0.12 for the first billion DNS queries.