Tag Archives: Azure

What is Azure DNS? And how do I get started?

One of the new Azure services announced at Ignite was Azure DNS. A globally replicated and highly available DNS service leveraging Anycast for fast DNS responses from anywhere around the globe. Wow. Since it’s using well known management tools (Powershell) and integration interfaces (REST and C#) Azure DNS is really easy to build upon and maximize on the investment.

The only thing I’m missing (for obvious reasons) is the ability to register and manage domains at a registrar level. Hopefully a <insert domain registrar name here> Resource Provider is only a matter of time.

I’m very excited about this since I am wasting was wasting a boatload of money on two A0 VMs in an availability set hosting DNS. Since I had a small boat it only fit about $30/month.. 😉
With Azure DNS I’m only paying $0.25 per zone and $0.20 per 1 billion queries. So I basically cut my DNS cost by 99% and reduced my management cost by about the same amount.

Gettings started with Azure DNS

To sign up for Azure DNS, which is currently in preview, you’ll have to use Powershell. Be sure you have at least version 0.9.1 installed. Even tho DNS Cmdlets have been hiding since November 26th, 2014.
You easily can download and install the latest version with the help of this post.

Switch-AzureMode -Name AzureResourceManager
# Had to re-register the Microsoft.Network provider for the DNS feature to ever become Registered
Register-AzureProvider -ProviderNamespace Microsoft.Network
Register-AzureProviderFeature -ProviderNamespace Microsoft.Network -FeatureName azurednspreview

Wait until RegistrationState turns into Registered. It should happen almost instantly.

Get-AzureProviderFeature -ProviderNamespace Microsoft.Network -FeatureName azurednspreview | fl *

FeatureName : azurednspreview
ProviderName : Microsoft.Network
RegistrationState : Registered

Next we’ll create our first DNS Zone. All zones must be placed inside a Resource Group.

New-AzureResourceGroup -Name WE-DMZ-DNS -Location westeurope
New-AzureDnsZone -Name runbookautomation.se -ResourceGroupName WE-DMZ-DNS
# Get DNS zone name server
(Get-AzureDnsRecordSet -ZoneName runbookautomation.se -ResourceGroupName WE-DMZ-DNS -Name '@' -RecordType NS).Records

Next up is the slow and tricky part. The last row in the previous snippet expands the name servers of your newly created zone. These name servers need to be configured at your domain registrar.

This is how it looked like at my registrar:

Once the DNS changes have replicated and Resolve-DnsName returns something like this you are good to go. The key property here is PrimaryServer.

Lastly we’ll create a CNAME record:

# Get the target Zone
$Zone = Get-AzureDnsZone -Name runbookautomation.se -ResourceGroupName WE-DMZ-DNS
# Create the DNS Record Set
$RecordSet = New-AzureDnsRecordSet -Name blog -RecordType CNAME -Ttl 3600 -Zone $Zone
# Add the CNAME value to the DNS Record Set
Add-AzureDnsRecordConfig -RecordSet $RecordSet -Cname blog-runbookautomation-se.azurewebsites.net
# Apply changes to Record Set in Azure
Set-AzureDnsRecordSet -RecordSet $RecordSet

Below is the complete code using variables for easier use.


Update Azure Powershell module with Powershell

A couple of months ago I shared a script that downloaded and installed the latest version of the Azure Powershell module. Since that time a lot of things have changed.

The module has moved from azure-sdk-tools to azure-powershell on GitHub!
The module has been updated from version 0.8.6 to version 0.9.1 with the help of over 3000 commits!
The module has gone from 434 cmdlets up to 761 cmdlets!

Below is a new snippet that leverages the GitHub API to download and install the latest Azure Powershell module:

Download and invoke the script to update. Or just run this one-liner:

Working with schedules in Azure Automation (and SMA)

The few of us that have started working with Azure Automation and/or SMA have probably noticed the lack of functionality that would equal a monitoring activity in Orchestrator.

I’ve seen some solutions which consist of a Runbook being set in an infinite loop with a sleep timer at the bottom.
In practice this method would replicated the desired functionality, that is, until the Runbook hits the maximum runtime value and kills the process. If you’re using Azure Automation this would also mean that you’ll be consuming Automation Minutes. 24/7.

What you’ll want to do with Azure Automation and SMA is to work with schedules to mimic a monitoring activity. And this can be a hassle to manage… Unless you’re using the right tools! 🙂
(Hint: Powershell.)

First we’ll want to create the required schedules. In 99% of the cases I work with hourly schedules at different minute intervals and I create them with the following script found at Technet Gallery.

If you use the “-Verbose” parameter you’ll get output on the schedule creation process.

And lastly we’ll want to assign Runbooks to the required schedules so the Runbook executes at the right time with the following script:

By piping to “Out-Gridview -Passthru” I can easily filter all the schedules and select the ones I want. Oh, and they script writes the intervals into the Description property of the schedules. This makes life a bit easier if you want the Runbook to execute, for example, every 5 minutes.


The result would look something like this in the Azure Management Portal:


I hope this helps you to manage your Automation Runbooks in a more efficient way and lower your Azure bill!

Again, the script can be found at: https://gallery.technet.microsoft.com/Generate-Azure-Automation-1dab9193

Microsoft Azure IaaS Cost Estimator Tool released!

Ever wondered what it would cost to run your datacenter on Azure? Good!

Are you running Virtual Machine Manger to manage your virtualization hosts? Even better! (But it doesn’t really matter)

Microsoft has released a cost estimator tool help you get a grasp of what your environment would cost to run on Azure!

Read more about the cost estimator tool at: Microsoft Azure IaaS Cost Estimator Tool