Manage your public DNS zones with Azure DNS

On May 4 2015, Microsoft has released a public preview of a new Microsoft Azure feature – Azure DNS.

Azure DNS is a hosting service for DNS domains, providing name resolution using Microsoft Azure infrastructure. By hosting your domains in Azure, you can manage your DNS records using the same credentials, APIs, tools and billing as your other Azure services.

You can find more information in the Azure DNS documentation.

The service is based on Azure Resource Manager (ARM), and can be managed using the Azure PowerShell module. The DNS cmdlets available in the module are added in the 0.9.1 release, which you can download from the Azure PowerShell repository on GitHub.

You can verify what version you have installed by using Get-Module –ListAvailable –Name Azure:

2015-05-09_Azure_DNS_01

The mode for the module must be switched to AzureResourceManager, and you must add your account and select your subscription as you normally do when working with the Azure PowerShell module:

Switch-AzureMode -Name AzureResourceManager
Add-AzureAccount
Get-AzureSubscription
Select-AzureSubscription -SubscriptionName "your subscription name"

It’s not currently possible to sign up for the DNS Service preview from the Azure portals, but this can be accomplished by using cmdlets in the Azure PowerShell module.

Register-AzureProvider -ProviderNamespace Microsoft.Network -Force
Register-AzureProviderFeature -ProviderNamespace Microsoft.Network -FeatureName azurednspreview -Force
Get-AzureProviderFeature -ProviderNamespace Microsoft.Network -FeatureName azurednspreview

It may take up to 24 hours for the registration state to change to Registered:

2015-05-09_Azure_DNS_02

Before creating a new DNS zone, you must decide what resource group to place the zone into. You may use an existing resource group, or you can create a new one:

New-AzureResourceGroup -Name Networking -Location 'West Europe'

For testing purposes, I’ve decided to use a subdomain of my powershell.no domain:

New-AzureDnsZone -Name azure.powershell.no -ResourceGroupName Networking

When the zone is created, you must add the appropriate Name Server (NS) records to the DNS zone at your registrar/hoster (it`s not yet available to host your domain in Azure). To find the values for the records you need to configure, you can use the Get-AzureDnsRecordSet cmdlet:

Get-AzureDnsRecordSet -ZoneName azure.powershell.no -ResourceGroupName Networking -RecordType NS

2015-05-09_Azure_DNS_03

In the DNS Control Panel at my registrar, it looks like this after I added the NS records for the Azure DNS Service:

2015-05-09_Azure_DNS_06

Now you can start creating DNS records in the new zone, and they should be resolved by the Azure DNS service.

New-AzureDnsRecordSet -Name www -RecordType A -ZoneName azure.powershell.no -Ttl 60 |
Add-AzureDnsRecordConfig -Ipv4Address '1.2.3.4' |
Set-AzureDnsRecordSet

You can then verify the new record by using familiar tools such as the Resolve-DnsName cmdlet or the traditional nslookup utility:

2015-05-09_Azure_DNS_04

To further explore the available cmdlets for managing Azure DNS, you can use Get-Command -Module AzureResourceManager -Name Dns

2015-05-09_Azure_DNS_05

You can also find more information and examples on the Azure DNS Documentation website.

About the author: Jan Egil Ring

Jan Egil works as a Lead Architect on the R&D Team at Crayon, Norway. He mainly works with automation, and has a strong passion for PowerShell. Products and services he works with includes Microsoft infrastructure products such as Windows Server, System Center and Microsoft Azure. He is a multiple-year recipient of Microsoft Most Valuable Professional Award for his contributions in the Windows PowerShell and Cloud & Datacenter Management technical communities. He speaks regularly at user groups and conferences, such as Nordic Infrastructure Conference (NIC), PowerShell Conference Europe and PowerShell Summit. He is a co-founder of the Norwegian Microsoft Technology User Group (MTUG), which is an association of local MTUG user groups in Norway. He is also co-organizing the MTUG Script Club which focuses mainly on PowerShell. You can follow him on Twitter @JanEgilRing.

Related Posts

%d bloggers like this: