Introducing the Azure Automation Runbook Gallery
By Beth Cooper Program Manager, Azure Automation
6 min read
Creating polished Azure Automation runbook solutions to automate your Cloud OS processes can take time to perfect, and may feel a bit intimidating at first. Now the time it takes to create functional, polished runbooks is a little faster thanks to the new Azure Automation Runbook Gallery. The Runbook Gallery is a new feature for Azure Automation that puts existing Automation sample, utility, and scenario runbooks right at your fingertips to help you get up and running quickly with your automation tasks. The Runbook Gallery allows you to browse and import runbooks to your Automation account without having to leave the Azure Management Portal. While our product team has created some samples to get you started, the best part of the Runbook Gallery is that the community can contribute content and have it automatically show up in the Gallery. It’s likely that if you have a problem, someone out there has faced a similar issue and has developed an Automation solution that you can build on. As more people contribute content, the community grows. As more people join the community, more content gets created. It’s a win win for everyone!
Finding Runbooks in the Gallery
Want to try it out? You can access the Runbook Gallery from +New.
Now select App Services > Automation > Runbook > From Gallery:
Now you should be in the Runbook Gallery Wizard. On the first page, we have broken down runbooks by category in order to help you identify the runbook that you would like to import. If a runbook does not fall under the list of categories, it will be under “All” which contains every runbook available, and “Other” which contains runbooks that do not have a tag which matches any other category. Note that runbooks can have multiple tags and may appear in multiple categories so you may find the solution you are looking for under multiple categories. If you do not find the solution that you are looking for and would like help in creating content, submit a request to Azure Automation’s UserVoice page. And if you’re looking to create some content to help others in the community out, be sure to check the UserVoice page for ideas.
The “Featured” category is a special category for Microsoft featured runbooks. This category is currently populated with our product team’s samples and utility runbooks. However, in the future our team would like to highlight the runbooks that we think are particularly useful, regardless of whether they are Microsoft or community created. I’ll discuss how you can get your content to display in the Gallery later in this post.
In addition to filtering by category, you can also filter out content from Microsoft or the Community by selecting / deselecting the checkboxes on the bottom left side of the wizard. Microsoft content is created by a Microsoft employee and these runbooks go through a review process with the Azure Automation product team before they are published to make sure that they provide quality content. Although content is published by Microsoft employees and is reviewed, Gallery runbooks are not officially supported. Those who contribute are just passionate about the community and are not required to maintain their runbooks as APIs and cmdlets evolve.
The pane on the right of the wizard will be populated with a brief description of the selected runbook and some useful data including the author and the number of downloads associated with that runbook. If you would like to go see the original source, you can click the title to be directed to the Script Center post where the content is being sourced from. You can rate the script and use the Q&A to ask the author questions on Script Center.
Once you find a runbook that you think you may be interested in using, you can click to the second page to see the source code. This is the code that will be imported to your personal Automation account if you chose to import it. Assuming that you like the runbook that you have seen, click the next arrow to go to the final page of the wizard.
On the final page of the wizard, you can now select the name of the runbook and which Automation account should store the runbook. The name of the runbook must always match the PowerShell Workflow name, so if you do chose to change the name of the runbook, the workflow name in the runbook content will automatically be updated to reflect your change. If this runbook is a child runbook in a series of runbooks, make sure that you update the name in the calling runbook as Automation will not automatically do this for you. Right now, you must also publish runbooks in order of the child-most runbook to the parent in order to run a collection of runbooks.
Once you import the runbook, you can click “View Runbook” in the notifications bar to take a look at the code and modify it if need be. Since everyone’s environments and processes are a bit different, and it is likely that you will need to create Automation assets or to configure the runbook to fit your specific needs, we do recommend that you take a look at the code in order to make sure you have all the necessary requirements in place.
Sharing your Runbook Content
If you have been creating your own content and would like to share it with others, you can post your runbooks to Script Center and they will automatically show up in the gallery within the next hour. Since we want to ensure that we have quality content in the Runbook Gallery, we ask that contributors follow a few simple rules outlined in our Gallery documentation. If you don’t see your runbook appear in the Gallery after an hour, its likely you missed one of the outlined rules. Before you publish, make sure that there is no sensitive information hardcoded in your runbooks – insert these secrets instead into Automation assets and reference those assets in your runbooks. We also highly recommend that you follow our best practices for runbook authoring. You can read about runbook writing best practices here and runbook writing tips and tricks here.
Follow these rules when you upload your runbook to Script Center:
- Upload your runbook to the Automation subcategory of the Azure category.
- Attach a single .ps1 file containing your runbook.
- The size of the runbook (.ps1 file) should not exceed 1MB.
- Insert a PowerShell Workflow code snippet into the Script Center description.
- If your runbook requires any modules, child runbooks, assets or other services make note of them in the Description in the runbook’s comments section (in the runbook file, not the Script Center description, although both places is great too)
- You should make sure to write your own short description instead of using the generated default as that is what will show up in the Runbook Gallery wizard.
- Tag your runbook with appropriate tags. The category tags are included below, but you can add your own tags as well.
- Disaster Recovery
- VM Lifecycle Management
- Change Control
- Capacity Management
- Dev / Test Environments
As mentioned earlier in this post, our team will be looking for great scripts to feature in the “Featured” category. We may even decide to create a blog post around your runbooks if you have some really great content – so post away!
Our team plans to continue expanding the Gallery in the future and the wizard that you see now will evolve over time. In the near future, we will include PowerShell scripts in the Runbook Gallery and will use the new runbook converter to convert scripts to Workflow. While this will expand the content available, we do recommend that you continue to follow the suggestions in the section above to upload content and to use PowerShell Workflow to take full advantage of PowerShell Workflow’s suspend / resume and parallelism capabilities, especially if you have long running tasks spanning multiple services or devices.
When you are creating an automation solution, you can think of the Azure Automation Runbook Gallery content as building blocks that you can stack together to create complete and more complex solutions that describe your business processes or help you with the day to day management of your Azure or 3rd party services. The Runbook Gallery should save you time and help you get going with Azure Automation, as well as help grow the Azure Automation community. We look forward to seeing the solutions that you and the rest of the Automation community contribute to the Gallery in the future.
Not an Azure Automation user yet? Sign up for the preview up for the preview and check out our Getting Started guide.