Nullsession.com

Sometimes IT works!

Getting started with Azure Automation

Azure automation is currently in preview so you might not see it in your portal if you haven’t enrolled already. You can enroll for Azure Automation at http://azure.microsoft.com/en-us/services/preview/and also find all other services currently in preview. It’s a good place to frequently check out, fun things emerge here!

So what is Azure Automation? Well, it’s the ability to run PowerShell workflow scripts from Azure, targeted at your Azure resources.

Once you’re enrolled into the preview program you can create your first automation account. An account can be seen as a container that you can fill with runbooks and assets needed by the runbooks. An asset can be for example a certificate allowing you to connect to your (or another) Azure subscription.

 

Automation dashboardThe overview over your runbooks looks like this. It’ll show you the number of runbooks, number of activites,  number of minutes you’ve ran your scripts and a whole lot more.

 

 

 

 

 

 

 

Now that you’re enrolled you might want to quickly just test it out, personally I love just getting a feel for things before diving into documenation. You can find example scripts and a how-to at http://azure.microsoft.com/en-us/documentation/articles/automation-create-runbook-from-samples/. One thing to note when creating your runbook is that your scripts name in the portal need to correspond to your workflow name. Ie if your workflow is named “Join-Servers-Domain” your runbook must be named the same.

 

Automation runbooks overviewLooking more at the portal, if you click “runbooks” up top, you can see your runbooks listed with their latest run time and status. This gives you a quick overview without having to look at each runbook individually.

 

 

 

Detailed view of runbook

Selecting one specific runbook gives you a chart over how it has ran over the some periods of time. Here you can also drill down into each script run and view script output and any input parameters.

 

 

 

 

 

Published runbookClicking on “author” while in detailed view takes you to the published version of the script. Here you can view your script and start it manually if you want to.

 

 

 

 

 

Runbook draftIf you opt for “draft” instead you’ll be able to edit your script and insert things from your assets library or other runbooks, allowing for runbooks to interact with each other. Here you can also test your runbook before publishing it.

 

 

 

 

 

Automation assetsThe assets library contains building blocks needed for your scripts to function properly. And it’ll make it easier for you to develop scripts for multiple subscriptions too.

In my example we have:

  • Connection to a subscription
  • A certificate which allows us to connect to this subscription (find a guide for that here)
  • PowerShell credentials so we don’t have to enter username/password each time
  • A module containing PowerShell cmdlets

 

 

You can read more about getting started with PowerShell workflows at http://technet.microsoft.com/en-us/library/jj134242.aspx.