Source Control for All Your Automation using Azure DevOps and Azure Automation Together

Just got back from a four day adventure with Altitude 365 in Malta. If you haven’t been there you should go! It’s a beautiful island with amazing people and very Blue Lagoons as you can see. If you implement Azure DevOps together with Azure Automation you’ll have plenty of time over for fun.

img_3807.jpg

I’m very proud to say that during our Malta trip I was upgraded to Black Belt, the highest consultant rank at Altitude 365. One reason for this, according to my colleagues, is that I’m good at keeping track of things, documenting everything and makes sure everything is in the right place. I’m very thankful for those words as this is something I’m always striving for!

In this article I will talk about how to create order around your automation with Azure Automation, Azure DevOps and some nifty features in those products.

Azure Automation

Lets start with Azure Automation. The process automation part of this product makes it possible for you to use PowerShell scripts, called runbooks, to automat all your tasks no matter where they run. You can run them in Azure, against another cloud or on-prem by installing Hybrid Runbook Workers who will fetch the runbooks and run them locally and send the output back to the cloud.

This is a key product to keep all your scripts, credentials and schedules in one place. You can also call runbooks from other sources like PowerApps, Microsoft Flow or your own applications via web hooks. Everything gets logged and you can monitor your automation jobs with Azure Monitor and send alerts on failures.

DevAuto1

Azure Automation is a very good place to store and run your scripts from but it’s not optimal for collaboration and source control. This is where Azure DevOps comes in with its Azure Repos product.

Azure Repos

Azure Repos gives you source control of your scripts using GIT repositories. In turn, this gives you versioning, change logs, backups, collaboration tools and much more. Your script developers can use a development environment of their choice, even notepad if they’re retro, and then push the changes to Azure DevOps.

DevAuto2

The cool part is that Azure Automation and Azure Repos can work together with source control. When you enable this connection, all your PowerShell scripts in your GIT repository will automatically be created as runbooks in Azure Automation. When you commits updates to you repository they will be published for you automatically.

DevAuto3

And now you have a DevOps CI/CD pipeline for you automation!!

VS Code and GIT

I always recommend using VS Code for you PowerShell scripting work. It has wonderful GIT integration which makes it perfect for your new pipeline. You do your changes, you commit and push to Azure DevOps and it will automatically deploy to Azure Automation. You don’t need to open any portals att all to deploy!

DevAuto4

Azure Boards

Use Azure Boards in Azure DevOps to plan your work, your sprints and collaborate. You can create tasks and assign them to people, report bugs, associate the tasks and bugs with script files and communicate around the progress. You can also see you current workload and allocate resources to optimize your work around automation.

DevAuto5

Teams and Azure Boards

And since Teams is the hub for teamwork, of course you should add the new board to your Teams team as a tab. This gives you the possibility to plan your DevOps work from inside Teams and you can let others join to see how you progress. Amazing stuff!

DevAuto6

Summary

With all these tools working together you and your team can become automation ninjas in no time. Don’t write scripts in PowerShell ISE and don’t manually deploy them as scheduled tasks on an old Windows Server 2012 R2 server. I see this all too often and I’m sorry but, in 2019 it’s just wrong.

Please follow me here, on LinkedIn and on Twitter!

@DanielChronlund

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s