Azure PowerShell Version 1.0 has great benefits, and also has many breaking changes. Since I wrote about updating a naked domain RecordSet, I received a few questions. This is a post about adding a Subdomain to an existing RecordSet.

Most of breaking changes are minor. If your script leveraged Azure Resource Manager (ARM), start by replacing ‘-Azure‘ with ‘-AzureRm‘. This change was made because the Switch-AzureMode CmdLet was removed.

Using PowerShell to Add a Subdomain

Login-AzureRmAccount -SubscriptionName 'Visual Studio Ultimate with MSDN'

$zone = Get-AzureRmDnsZone -Name 'alexandrebrisebois.com' `
                           -ResourceGroupName 'BriseboisDNS'

$recordSet = New-AzureRmDnsRecordSet -Name 'liveqna' `
                                     -Zone $zone `
                                     -Ttl 60 `
                                     -RecordType CNAME

Add-AzureRmDnsRecordConfig -RecordSet $recordSet `
                           -Cname 'liveqna.eastus.cloudapp.azure.com'

# Don't forget to use the Set-AzureRmDnsRecordSet cmdlet
# to apply the changes

Set-AzureRmDnsRecordSet -RecordSet $recordSet

Resolve-DnsName -Name 'liveqna.alexandrebrisebois.com' 
                -Type ALL 
                -DnsOnly

Trackbacks and Pingbacks:

  1. Dew Drop – January 26, 2016 (#2174) | Morning Dew - January 26, 2016

    […] Azure DNS – Using PowerShell V1.0 to Add a Subdomain (Alexandre Brisebois) […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.