Fix known problems with runbooks

DevOps, Hands On30 minutesFree tierWritten 19 November 2026By Cloud Hands On

In this task you'll run a fix automatically when a known alert fires.

A runbook is a script for a known problem: restart a stuck service, clear a full disk, scale out a queue worker. Azure Automation runs PowerShell or Python runbooks in Azure with a managed identity, on a schedule or from an alert's action group.

Self-healing needs guard rails: a limit on how many times it runs per hour, a record of every run, and an alert to a person when the fix didn't work, so automation never hides a growing problem.

Example. SS Kaiser's queue worker sometimes hangs. A runbook triggered by the 'queue length over 500 for 10 minutes' alert restarts the worker app, waits, checks the queue is draining, and opens an issue if it isn't.

Before you start

You need: Contributor on a resource group. Time: 30 minutes.

Where to look

  1. Automation accounts
  2. Runbooks

Steps

  1. Create an Automation account with a system-assigned managed identity, and give it the narrowest role on what it must fix.
  2. Write and test the runbook; make it safe to run twice.
  3. Link it to the alert's action group (or a webhook).
  4. Add guard rails: a run limit, logging, and a person paged if the problem continues.

Commands

az automation runbook start -g <group> --automation-account-name <account> -n <runbook>

Watch out for

Cost
Azure Automation includes a monthly allowance of free job minutes; check the pricing page.
Security
The managed identity's role decides what the runbook can break: keep it narrow.
Common mistakes
Runbooks that loop (fix, fail, fix again) and hide a real outage.

Clean up

Delete the Automation account or the lab resource group.

Words to know

Azure Automation
Azure service that runs runbooks (PowerShell or Python) on schedules or from alerts.
Self-healing
Automation that detects and fixes a known problem without a person.
Guard rail
A limit that stops automation doing harm, such as a maximum number of runs per hour.

Tick off each step and track your progress in the guide.

Open this task in DevOps, Hands On

Keep going