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.
Select your source control system, in this example I use GitHub.
Because Azure will sync runbooks between Azure Automation and GitHub, you need to give authorization.
After this is done, you can verify who is authorized to access your repository in the GitHub account settings.
Let’s continue and select one of your repositories where you want to store your Azure Automation runbooks.
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.
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.
This ends the configuration. The configuration can be reviewed in the Azure Automation account blade.
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.
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.
Once the job is completed, you should be able to see the runbook in your GitHub repository.
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.
Once this is done, I now start the runbook sync manually from Azure Automation.
This will again start a sync runbook that will bring the new runbook from GitHub over to your Azure Automation account.
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
Pingback: Using Github Source Control with Visual Studio | marcelzehner.ch
Is there a way to automatically run the sync?