Process Automation via Azure Automation Accounts
I am tempted to call the Azure Automation Service a "Task Scheduler on steroids". It is of course an oversimplification as the Azure Automation service is used for more than just scheduling tasks but I guess it can serve as a good introduction to what automation accounts are all about.
According to Microsoft's official documentation, "Azure Automation delivers a cloud-based automation, operating system updates, and configuration service that supports consistent management across your Azure and non-Azure environments. It includes process automation, configuration management, update management, shared capabilities, and heterogeneous features."
Azure Automation Service Components
To get started working with Azure Automation, one would need to create an Automation Account.
The Azure Automation Service and specifically its "Process Automation" component, is a service that enables you to automate manual, time consuming, error prone, repetitive tasks in Azure (and also in hybrid environments) thereby freeing up time, reducing the risk of human errors and boosting efficiency.
Process automation makes use of runbooks primarily. A runbook is where you define the logic that controls how the task(s) you want to perform will be carried out. Call them scripts and you won't be far off. These runbooks could be graphical, PowerShell or Python runbooks.
Runbooks in Azure Automation can run on either an Azure sandbox or a Hybrid Runbook Worker. By default, runbooks run in Azure (or against azure resources). Another way to put this in relation to resources like virtual machines is that runbooks perform actions on the "outside" of a virtual machine. To run runbooks directly on (or "inside") a Windows or Linux virtual machine or against resources in an on-premises environment or other cloud environment, you can deploy a Hybrid Runbook Worker.
Once the runbooks are created, saved and published, they can be either be run manually as one-off jobs or can be triggered using a schedule or a webhook.
To run the runbook as a manual/one-off job, from the runbook's page in the portal you can click on the "start" icon and then choose whether you want the runbook to run on Azure or via a hybrid runbook worker.
For runbooks that you would like to run on a recurring basis, you would have to create a recurring schedule and link it to the runbook. To create a schedule,
Go to the "shared resources" section of the automation account and click on schedules.
click on "Add a schedule" and fill in the details of the new schedule.
specify the start time for the schedule
choose whether the runbook runs once or on a recurring schedule
specify the recurrence frequency
specify whether the schedule expires or not.
click create.
Once created, you can link the schedule to a runbook directly from the runbooks page.
To trigger a runbook using a webhook,
click on "Add a webhook" from the Automation Account's overview page
click create a new webhook
On the dialogue page, enter the details of your webhook.
specify if you want it enabled or disabled.
Specify an expiry date
The webhook url will have been automatically generated
Specify the "Run on" settings to decide whether runbook runs on Azure or in a hybrid worker.
Click create.
Once the webhook is created, the webhook url can be called to trigger the runbook. A common use case is to add the webhook to the action group of azure alerts.
This has hopefully been a good (gentle) introduction to Azure Automation and especially process automation in Azure. I intend to delve a bit more into hybrid runbook workers in my next post(s) so do make sure to be on the lookout for that.
Cheers!
Useful Links:
Subscribe to my newsletter
Read articles from Israel Orenuga directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Israel Orenuga
Israel Orenuga
A tech enthusiast and cloud engineer with a passion for sharing knowledge. Through this blog, I delve into the world of Cloud computing, DevOps, Cloud Security and the latest in tech trends. Join me on this journey as I explore and demystify the digital world. Outside of tech, I’m an avid soccer fan and enjoy writing. This blog combines my professional insights with my creative passions.