AWS, Cloud Computing

4 Mins Read

An Introduction to Azure Automation Account with a Usecase for Runbook

Voiced by Amazon Polly

Introduction

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.

Prerequisites

  • Azure Automation account
  • Resource groups

Process Automation

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

runbook1

Give the Automation account a name and choose a Resource group as well.

runbook2

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.

runbook3

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

runbook4

Provide a runbook name and runbook type as PowerShell Workflow. Also, ensure the Runbook name matches the name of the source code file.

runbook5

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

runbook6

These are the below resource groups on my account before the runbook execution

runbook7

After execution, you can see the output below: 

runbook8

runbook9

Next, we will go back to the code and choose to publish

runbook10

Once you publish your Runbook, we can be able to start it straight away, we can schedule it, or we can add Webhook.

runbook11

After publishing your Runbook, whenever the Runbook gets executed, the logs and output are stored in the Jobs section under Process Automation.

runbook12

runbook13

Conclusion

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.”

About CloudThat

CloudThat is also the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold 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. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Drop a query if you have any questions regarding Automation, Azure Automation Account, or Runbooks and I will get back to you quickly.

To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.

FAQs

1. How can we manage pathing using Runbook?

ANS: –  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?

ANS: – 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?

ANS: –  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.

WRITTEN BY CloudThat

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!