11 Sample Runbooks to Help You Build Your Own
2 weeks ago, I posted an article regarding Automating Azure with runbooks. I got some really good feedback and some good questions I decided to address. But first, as usual, if you have not had any exposure to Azure. I recommend the following MVA modules as primer.
- Automating the Cloud with Azure Automation
- Microsoft Azure IaaS Deep Dive Jump Start
- Get Started with Windows Azure Today Jump Start
- Windows Azure for IT Pros Jump Start
To the Q&A now:
Q: “Where can I find some Runbook samples?”
A: The TechNet Script Center has a number of sample runbooks that illustrate the techniques and best practices for building your own.
- Hello World for Azure Automation
- Copy a File from an Azure VM
- Copy a File to an Azure VM
- Connect to an Azure Virtual Machine
- Connect to an Azure Subscription using Certificates
- Using runbook parameters in Azure Automation
- How to use a SQL Command in an Azure Automation Runbook
- How to use workflow checkpoints in Azure Automation Runbooks
- How to use a PS Command on a remote Azure VM from a Runbook
- How to Invoke a Child Runbook
- How to use Automation Assets in a Runbook
Q: “Why not use PowerShell and DSC extension?”
A: In order to provide high availability of workflow execution, Azure Automaton executes PowerShell code in different PowerShell sessions, in different processes, and even on different machines. In this context, replacing Automation Assets with regular mechanisms available in pure PowerShell workflow is very challenging.
Basically, you get the same benefits as straight PowerShell with added benefits that the usage of assets gives:
- Centralized management of constant values
- Sharing of assets (Variables, Connections, and Credentials) between jobs. In PowerShell you can do this but have to invent your own mechanism.
- Secured management of credentials and connections
- Out of box scheduling capability
Q: How do I create a new runbook?
A: Whatever tool you use to write your scripts is fine to create runbooks. you can use the Integrated Scripting Environment.
Or you can use the portal to create a runbook and edit it online:
- In the Azure Management portal, click, New, App Services, Automation, Runbook, Quick Create.
- Enter the required information, and then click Create. The runbook name must start with a letter and can have letters, numbers, underscores, and dashes.
- If you want to edit the runbook now, then click Edit Runbook. Otherwise, click OK.
- Your new runbook will appear on the Runbooks tab.
Feel free to send me your questions. and I encourage you to try your hand at writing your own runbooks and harness that power.