GitHub Source Control for your Azure Automation Runbooks

If you work with Automation you might know that you will only be successful when following crystal clear developlent guidelines and processes. One important factor to keep in mind – especially in larger projects with many involved automation engineers – is source control. Azure Automation helps you out here by allowing to connect runbooks to a source control platform. Today, only GitHub can be used, Visual Studio Online will follow soon. This article guides you through the setup process.

I assume you already have a GitHub Account with a repository. If not, go to the GitHub website, create an account and a repository before you continue. Now use an existing Azure Automation account or create a new one to start enabling source control with it.

image

Select your source control system, in this example I use GitHub.

image

Because Azure will sync runbooks between Azure Automation and GitHub, you need to give authorization.

image

image

After this is done, you can verify who is authorized to access your repository in the GitHub account settings.

image

Let’s continue and select one of your repositories where you want to store your Azure Automation runbooks.

image

A GitHub repository can have multiple branches. In this case I only have the “master” branch and will use this. In a prod environment I can indeed make sense to use another branch to develop new runbooks or edit existing onces. This branch can later be merged with the master once everything is tested and approved. If you are not familiar with the branch concept, check out the GitHub website for more details.

image

In case I only want to sync runbooks that live in a specific folder in my GitHub repository, I can enter the folder name. In this case I have a repository only for Azure Automation runbooks, so I enter “/” to enable everything for synchronization.

image

This ends the configuration. The configuration can be reviewed in the Azure Automation account blade.

image

I will now create and edit a new runbook in the Azure Automation website. Once the runbook is created, I can now check it on to GitHub by clicking on the appropriate button.

image

image

This will start a hidden runbook that will sync the runbook to the configured GitHub repository. By clicking on the source control tile I can monitor the process.

image

image

Once the job is completed, you should be able to see the runbook in your GitHub repository.

image

This also works the other way around. You can add a new runbook to your GitHub repository and sync it to Azure Automation. Let’s start by uploading the runbook.

image

image

Once this is done, I now start the runbook sync manually from Azure Automation.

image

image

This will again start a sync runbook that will bring the new runbook from GitHub over to your Azure Automation account.

image

image

Done! You are now ready to start working with your Azure Automation runbook source control solution. I will create more blog posts on this topic soon because we as a company see the importance of this growing for us as well as for our customers.

Cheers
Marcel

This entry was posted in automation, Azure, Source Control and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to GitHub Source Control for your Azure Automation Runbooks

  1. Pingback: Using Github Source Control with Visual Studio | marcelzehner.ch

  2. Adam Levitt says:

    Is there a way to automatically run the sync?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s