26 Apr

Azure Automation: First Time Setup

azure As we saw in the previous post, we saw the clear benefits of Azure Automation. It is really a service that can make our IT-lives a bit easier to maintain.
For those who didn’t read the previous post: Azure Automation allows you to upload PowerShell scripts to Azure, and then configure Automation to let them run automatically at certain moments. It’s really nice to automate all those little annoying jobs that just rob our time.

But how longs does it take to set this up? How difficult is it?
Let’s set things up for the first time use.


  • Azure Subscription
  • Subscription Name / ID

First, let’s create the automation account.
Log on to your Azure subscription via https://manage.windowsazure.com and scroll down to you see Automation. Just press create and give your account a name.

Please note that there are only 6 regions for Automation available for now:  East U.S., South Central U.S., Southeast Asia, Central India, West Europe and Japan East. It doesn’t matter which region that you pick, but for best practice: pick the one that is closest to your environment’s region.
And that is that! You have your account and you are ready to set everything in order. A quick overview:

  • Dashboard: you can find general information, such as which jobs run when, and also which are Queued, Failed, Stopped, Suspended, Completed, or still running. You can also find your logs here, as well as a small overview of you Automation account
  • Runbooks: Here you can find all your drafted and published Runbooks.
  • Assets: If not the most important part for Automation! Here you can define your Variables, Certificates, Modules, Schedules… Everything to make it work smoothly.
    Quick Note: With modules, the stress lies on the PowerShell-modules that can be added to the Automation account. Managing Exchange? Yes. Configuring Active Directory? No problem! It can all be done here!
  • Scale: Selection screen for your pricing plan: Free or Basic. Free offers all functionality, but only a limited amount of job runtime.

There are 2 ways to work with Automation:

  1. Define your variables in every Runbook that you make
  2. Define your variables in the portal and link a separate Runbook to run it for you.

And since we are going full-auto, why not use the latter? It is also a lot easier and does not differ too much from your regular PowerShell functions.

Defining your variables!
You can define ALL your variables in here (if support by your modules of course, but for basic configuration no additional modules are needed).
We are going to need 3 Variables:

  1. SubscriptionName
  2. SubscriptionID
  3. StorageAccountName

It’s pretty simple to see why we need those 3: Because they are the bread and butter of your PowerShell commands. Without those, connection to your Azure tenant is impossible.
Yes, you can do it without the StorageAccount name, but it is better to have it already.

Navigate to “Assets” under you Automation account. Once there, press “Add Setting” at the bottom of your page and select “Add Variable”.
On the next page, select your Variable Type. For the 3 above, we will select a String.
Now comes the naming of your Variable. Here’s the catch: Your Variables name must be THE SAME as the variable you are going to define in your Runbook. This means that whichever name you are going to choose here, must also be using that Variable Name in your Runbooks.
Apart from that, define your SubscriptionName, SubscriptionID and StorageAccountName.

Next, you can start importing your scripts.

Once you have done that, you can start setting up your Schedules and other Variables. It all depends on what you would like to accomplish.
After this, I will show you a way to manage your VM’s via Automation.

Leave a Reply

Your email address will not be published. Required fields are marked *

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