11 Sample Runbooks to Help You Build Your Own

Hello Folks,image

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.

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.

image

  1. Hello World for Azure Automation
  2. Copy a File from an Azure VM
  3. Copy a File to an Azure VM
  4. Connect to an Azure Virtual Machine
  5. Connect to an Azure Subscription using Certificates
  6. Using runbook parameters in Azure Automation
  7. How to use a SQL Command in an Azure Automation Runbook
  8. How to use workflow checkpoints in Azure Automation Runbooks
  9. How to use a PS Command on a remote Azure VM from a Runbook
  10. How to Invoke a Child Runbook
  11. 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:

  1. Centralized management of constant values
  2. Sharing of assets (Variables, Connections, and Credentials) between jobs. In PowerShell you can do this but have to invent your own mechanism.
  3. Secured management of credentials and connections
  4. 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.

image

Or you can use the portal to create a runbook and edit it online:

  1. In the Azure Management portal, click, New, App Services, Automation, Runbook, Quick Create.
  2. Enter the required information, and then click Create. The runbook name must start with a letter and can have letters, numbers, underscores, and dashes.
  3. If you want to edit the runbook now, then click Edit Runbook. Otherwise, click OK.
  4. 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.

Cheers!

clip_image011

Pierre Roman | Technology Evangelist
Twitter | LinkedIn