TABLE OF CONTENT
|3. Process Automation|
|4. Types of Runbooks|
|5. Azure Usecase for Runbook|
|7. About CloudThat|
Automating repetitive tasks can make the job easier and reduce manual errors. The Azure Automation Account helps you to orchestrate complex and repetitive operations that can be used for both Azure and Non-Azure environments. Azure Automation manages your infrastructure and applications throughout the lifecycle. Here in this blog, we are going to look more deeply into this service provided by Azure. We will also execute Runbooks in the Automation account for two use cases.
- Azure Automation account
- Resource groups
It orchestrates processes using graphical, PowerShell & Python Runbooks. Runbooks are the scripts hosted in Azure Automation. Different triggers like Schedule and Webhook can launch these Runbooks; Azure alerts, Logic apps, PowerShell & Watcher Tasks, which gives the user a lot of flexibility in creating custom automation. When the Runbook is ready, you can send it for automation, and Azure assigns a worker to run each job during Runbook execution. The point to note here is that Azure Automation itself manages the worker created by Azure for this task. They are called Azure Sandbox. Hybrid Runbook Worker can also execute Runbooks directly on the computer that hosts the role and against local resources in the environment.
Type of Runbooks
- PowerShell runbooks
- PowerShell Workflow runbooks
- Graphical runbooks
- Python Runbooks
Here we will see a use case for the PowerShell Workflow runbook.
Azure Usecase for Runbook
a) Automation account creation
Log into the Azure console and go to the Automation account
Give the Automation account a name and choose a Resource group as well.
Once it is created, do select Azure Run as an account on the Run as account option under the Account settings.
Runbooks will get executed if and only if this permission is added.
b) Implementing PowerShell Workflow for deleting empty Resource Groups
Once this Runbook is executed Azure Automation deletes the resource group which has no resources attached to it.
Under Process Automation select Runbooks and choose to Create a runbook
Provide a runbook name and runbook type as PowerShell Workflow. Also, ensure the Runbook name matches the name of the source code file.
Insert the code from the given GitHub link and save it. Select the Test pane to test it on Azure.
Select Start to execute the imported runbook
These are the below resource groups on my account before the runbook execution
After execution, you can see the output below:
Next, we will go back to the code and choose to publish
Once you publish your Runbook, we can be able to start it straight away, or we can schedule it, or we can add Webhook.
After publishing your Runbook, whenever the Runbook gets executed, the logs and output are stored in the Jobs section under Process Automation.
This blog has seen various types of Runbooks and a use case for PowerShell Workflow runbook. Likewise, you can use this to integrate with Azure alerts, Azure Site Recovery, VM Patching, and other third-party systems for managing your processes. Azure Automation may look simple but it is a very powerful service for both processes automation and daily operations. I am ending this blog with this statement, “Azure Automation has optimized the overall operational processes, thus, increasing the overall performance significantly.”
CloudThat is the official AWS (Amazon Web Services) Advanced Consulting Partner, Microsoft Gold Partner, Google Cloud Partner, and Training Partner helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Explore our consulting here.
If you have any queries regarding Automation, Azure Automation Account, or Runbooks, drop a line below the comments section. I will get back to you at the earliest.
1.) How can we manage pathing using Runbook?
Azure Automation Update Management does use the System Hybrid Runbook Worker, and the installation of Update/patch is done through Runbooks. It can also be used to manage OS updates for physical machines/VMs in on-premises environments and in other cloud environments
2.) What is a Watcher task?
A watcher task allows you to watch for events and trigger actions. It is comprised of a watcher runbook and an action runbook. The watcher searches for an event and triggers the action when an event occurs. For example, you can watch a folder for new files and trigger an action that backs up those files when they are created.
3.) What is a Hybrid Runbook Worker?
A Hybrid Runbook Worker is a server that resides locally inside your on-premises data center, in AWS or in Azure, or can exist virtually anywhere in the world. It gives you the capability to hybrid manage your complete infrastructure. You can automate tasks against your infrastructure leveraging Azure Hybrid worked capabilities provided by Azure Automation.