Before we get started it’s important to know where Microsoft Azure Automation fits in the available automation options for Windows Azure.
Microsoft Azure Automation is a new feature within the Microsoft Azure Platform which allows Cloud Administrators to centrally manage automation assets (scripts, global variables) and schedule automation tasks, with a main focus on manual, long-running, error-prone, and frequently repeated tasks (Release resources, Manage backups, Monitoring etc.).
Microsoft Azure Automation
Up till now, there have been several ways to mimic an environment like Microsoft Azure Automation however this was quite some work or costly, especially if you include more advanced features like workflows, task execution history, global variables, a dashboard and a script change log/repository. Now before I would like to move on and cover the Microsoft Azure Automation building blocks and basic concepts, it’s interesting to know that this Microsoft Azure Automation is built upon System Center Orchestrator.
Before getting started…
Now at the time of writing, the Microsoft Azure Automation feature is still in beta. Therefore it’s required to enable “Preview features “as explained on this page http://azure.microsoft.com/en-us/services/preview/
At this stage, it’s required to create an Automation account. This is basically a way to organize Automation assets (runbooks, scripts etc.). In addition, every Automation account has a separate Dashboard to avoid clutter. Note that resources for each Automation account are associated with a single Azure region.
Microsoft Azure Automation building blocks
Now before we can start diving in the world of Microsoft Azure Automation, it necessary to cover some basics.
- The Runbook, the core of Microsoft Azure Automation, is basically a container for automation tasks or, to be more precise, a container of PowerShell workflows.
- Automation Assets are globally shared variables which can be accessed within the Runbook.
Creating a Microsoft Azure Automation Runbook
Runbooks can be created from scratch or you could download and import a pre-build Runbooks from TechNet. Or by using the Runbook gallery located within the Microsoft Azure Portal.
For this sample we will create a new Runbook from scratch by clicking on Runbooks within the Microsoft Azure Automation Account page, New -> Automation -> Runbook -> Quick Create, and provide a name.
At this stage, the Runbook has been created with a default state of draft. Runbook details, including a dashboard, jobs, schedule, log settings, and the PowerShell script (author tab) can be found by opening the Runbook.
Adding automation code within your Runbook.
The process of adding code within your Runbook is fairly simple. Start by opening the Runbook details, now open the Author tab and the Draft. At this point, you will see the default template as listed below
Given that this is just a simple introduction, I will only include some basic logging as displayed below. Implementing the details isn’t much different from accessing Azure resources via PowerShell locally.
Note: Testing a script will execute your code without any hidden safety measures; therefore resources will be created, deleted as stated within your script!
At this stage, you will be able to test your Runbook by clicking on Test.
This just covers some of the basics of Microsoft Azure Automation. In a later blog post, I will cover some other aspects as the Publishing, different Assets and Scheduling