Join our Newsletter — 33% off our NHI Course
Home› Guides› Azure Automation Accounts Security: Runbooks, Managed Identities and…
Guide Cloud & Workload Identity

Azure Automation Accounts Security: Runbooks, Managed Identities and Hybrid Workers

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

An Azure Automation account combines stored code, stored secrets and a privileged identity in one resource, so anyone who can edit a runbook can act with whatever rights that identity holds. Automation accounts often outlive the projects that created them, keep running scheduled jobs for years, and carry managed identities granted Contributor on whole subscriptions during a migration that nobody revisited. This guide shows Azure cloud and platform engineers how to secure the parts the customer controls: the identity runbooks use, who can edit and run them, credential and variable assets, webhooks, Hybrid Runbook Workers that run code on your own servers, network isolation and the logs that show misuse. For the wider Azure baseline, see the Microsoft Azure Security Guide; this page goes deeper on Automation only.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public Azure Automation documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • The identity is the blast radius. Scope each Automation managed identity to the exact resources and actions its runbooks need, never Contributor or Owner at subscription scope.
  • Runbook edit rights equal identity rights. Automation Contributor and Contributor can change runbooks that run as the account's identity, so treat those roles as privileged and put them behind PIM.
  • Run As is gone; check what replaced it. Run As accounts retired on 30 September 2023; confirm no runbook still depends on one and that the managed identity did not inherit the old default Contributor role.
  • Hybrid workers are servers running your cloud code. Harden and restrict access to them like any privileged host, and never install the worker on a domain controller.
  • Webhook URLs are passwords. They cannot be retrieved after creation, every input is logged with the job, and only an expiry, disable or delete removes them.

What Azure Automation accounts are and why they matter

An Automation account holds runbooks (PowerShell, Python or graphical), schedules, webhooks and shared assets (credentials, certificates, connections and variables). Jobs run either in Azure's cloud sandbox or on Hybrid Runbook Workers, which are your own Windows or Linux machines in Azure, on Azure Arc-enabled servers or on premises. Runbooks authenticate to Azure with the account's managed identity.

That combination is why Automation accounts appear in persistence techniques: an attacker with write access can add a runbook with a schedule or webhook that runs indefinitely as a trusted identity, with no user sign-in to detect. Defenders should treat each account as a privileged non-human identity with its own owner, inventory entry and review cycle.

ComponentWhat it holds or doesMain riskPrimary control
Managed identityEntra identity used by runbooks to call Azure and Microsoft GraphOver-broad Azure RBAC or Graph permissionsLeast-privilege role assignments at resource or resource group scope
RunbooksCode that runs on a schedule, webhook or manual startMalicious edits that act as the identityRestrict Automation Contributor; review runbook changes
Credential, certificate, connection and encrypted variable assetsSecrets used by runbooksExposure through job output or edited runbooksEncryption (Microsoft-managed or customer-managed keys); never print values
WebhooksToken-bearing URLs that start a runbookURL leakage starts jobs without authenticationExpiry, validation in the runbook, private endpoint
Hybrid Runbook WorkersMachines that run jobs locallyHost compromise or code execution on premisesExtension-based worker, host hardening, restricted admin access
Automation keysRegistration keys for DSC nodes and agent-based workersRogue worker or node registrationPrefer extension-based workers; rotate keys; limit listKeys

Managed identities and Run As retirement

Microsoft retired Azure Automation Run As accounts, including Classic Run As accounts, on 30 September 2023. Each Run As account had registered an Entra application with a self-signed certificate that needed monthly renewal, and Microsoft's documentation notes that Run As accounts had Contributor on the subscription by default. New Automation accounts have a system-assigned managed identity enabled by default.

  1. Find remaining dependencies: use Microsoft's IdentifyRunAsRunbooks.ps1 script to list runbooks that still reference AzureRunAsConnection, and check for leftover Run As app registrations and certificates in Entra.
  2. Choose the identity type: system-assigned identities are tied to one account and deleted with it. User-assigned identities can be shared, but Microsoft states they support cloud jobs only; Hybrid Runbook Workers use a system-assigned identity. One identity per account and purpose keeps the blast radius small.
  3. Grant rights deliberately: Microsoft's AssignMIRunAsRoles.ps1 copies Run As roles to the managed identity, which also copies a default Contributor assignment if one was never reduced. Grant instead only what each runbook does, for example the start and stop actions on named virtual machines, or read on a single storage container.
  4. Update code and test: replace the Run As logon with Connect-AzAccount -Identity on a copy of the runbook, move from AzureRM to Az modules (AzureRM retired on 29 February 2024), then promote.
  5. Clean up: delete the old Run As application and certificate once no runbook uses them, so an orphaned credential cannot be reused.

Audit the result with How to find over-privileged Azure managed identities. Managed identity design in general is covered in the Azure Managed Identities Security Guide.

Roles: who can change and run automation

Microsoft's role documentation warns that Automation Contributor can be used to access any resource the managed identity can reach. Contributor and Owner include the same Automation actions. Plan role assignment on that basis.

RoleCan edit runbooks and assetsCan start jobs and read outputUse it for
OwnerYes, and can manage accessYesBreak-glass only; avoid at account scope for day-to-day work
ContributorYes, cannot manage accessYesAvoid for automation authors; too broad outside Automation
Automation ContributorYes, cannot manage accessYesRunbook authors, eligible through PIM, at account scope
Automation OperatorNoYes: create, stop, suspend and resume jobs; read job output and streamsOperators who run approved runbooks
Automation Job OperatorNoYes, for runbooks they can readCombined with Runbook Operator for per-runbook control
Automation Runbook OperatorNoReads runbook properties; can start a runbook when combined with Job OperatorRunbook-scope assignment
ReaderNoNoInventory and audit
  • Avoid broad scopes and wildcards: Microsoft recommends granular Automation roles, avoiding subscription-level scope and wildcard actions such as automationaccounts/*/read.
  • Use PIM: make Automation Contributor, Contributor and Owner eligible rather than permanent on accounts whose identity holds production rights.
  • Restrict listKeys: Owner, Contributor and Automation Contributor can read Automation account keys by default; use a custom role with Microsoft.Automation/automationAccounts/listKeys/action only where key access is needed.
  • Remember job output: Automation Operator and Job Operator can read job output, so anything a runbook prints is visible to them.

Runbook and credential asset security

  • Encryption: credentials, certificates, connections and encrypted variables are encrypted by default with Microsoft-managed keys. Use customer-managed keys in Azure Key Vault where policy requires control of the key. For secrets shared with other workloads, keep them in Key Vault and have the managed identity read them at run time. See the Azure Key Vault Security Guide.
  • Never print secrets: Microsoft's guidelines warn against writing credential or certificate details to job output, which lower-privilege operators can read. Credentials are removed from job streams before they reach diagnostic logs, but plain variables and custom output are not.
  • Mark variables encrypted: store any sensitive value as an encrypted variable; an unencrypted variable is readable by anyone who can read the account.
  • Control change: keep runbook source in a repository with review, use source control integration where it fits, and back up runbooks and assets. Treat a runbook edit outside the pipeline as a security event.
  • Retire unused content: delete runbooks, schedules and assets that no longer run. Dormant runbooks with a live identity are attractive to an attacker who wants a quiet foothold.

Webhook handling

  • Treat the URL as a secret: it carries a security token, anyone with it can start the runbook, and it cannot be retrieved after creation. Store it in a secrets manager and never place it in ARM template outputs, because deployment history is readable by principals with Reader.
  • Set a short expiry: the portal defaults to one year. An expired webhook cannot be reactivated; you delete and recreate it, which issues a new URL. Use Disabled to stop a webhook immediately.
  • Validate in the runbook: check WebhookData (name, headers, body) and, where possible, confirm an external condition before acting. Microsoft advises against webhooks for highly sensitive runbooks without an extra validation method.
  • Keep sensitive data out: all webhook input values are logged with the job and visible to anyone with job access.
  • Restrict the network path: use the Webhook private endpoint sub-resource, or the GuestAndHybridManagement service tag in NSGs or Azure Firewall.

Hybrid Runbook Workers

A Hybrid Runbook Worker turns cloud-authored code into local execution, so it extends the Automation account's trust boundary into your data centre. Microsoft directs customers to the extension-based (V2) worker, which authenticates with Entra ID and does not depend on the Log Analytics agent, and to migrate agent-based (V1) User workers. Removing a V1 worker from the portal leaves the agent on the machine, so uninstall it as well.

  • Placement: never install the worker on a domain controller; Microsoft calls this out as a high-risk attack vector. Use dedicated worker machines grouped by the trust level of the systems they manage.
  • Run-as account: by default the Windows extension runs jobs as Local System. Where jobs do not need that, set the worker group's Hybrid Worker credentials to a custom credential asset with only the folder permissions Microsoft lists, granted directly to the account.
  • Host access: anyone with VM Contributor, run command or local admin on the worker can tamper with jobs or read what they handle. Restrict those rights and apply the same endpoint hardening, EDR and patching as for other tier-zero-adjacent servers. For Arc-connected workers see the Azure Arc-Enabled Servers Security Guide.
  • Identity: the system-assigned managed identity of the worker machine is enabled when the worker is added; scope its rights as tightly as the account's.
  • Lifecycle: unregister unused or unresponsive workers, keep minor extension versions on automatic upgrade (the default), and use hybrid worker custom roles for people who register workers or manage groups.
  • Network: workers need outbound TCP 443 to *.azure-automation.net; with Private Link they reach the account through the DSCAndHybridWorker endpoint.

Network isolation and private endpoints

Azure Private Link gives the account private IP addresses in your virtual network through two sub-resources: Webhook for webhook calls and DSCAndHybridWorker for hybrid workers, State Configuration and the job runtime. Resolve names through a private DNS zone named privatelink.azure-automation.net.

Setting Public network access to disabled (Network Isolation under Account Settings) means only private endpoint connections are allowed; public calls receive HTTP 401. Plan for the documented trade-offs before switching:

ChoiceBenefitTrade-offFits
Public access with webhook validationSimplest; cloud jobs and alert-triggered webhooks workWebhook URL reachable from the internetLow-impact runbooks, small estates
Private endpoints with public access enabledWorkers and internal callers use private pathsPublic endpoint still exposedTransition phase
Private endpoints, public access disabledNo public path to the accountAlerts cannot trigger webhooks; cloud jobs cannot reach private-endpoint resources, so jobs move to hybrid workers in a virtual networkAccounts whose identity holds production or tenant-wide rights

Monitoring and detection

Send Automation resource logs to Log Analytics through diagnostic settings. Records arrive in the AzureDiagnostics table with ResourceProvider == "MICROSOFT.AUTOMATION", with up to 15 minutes of ingestion lag. The AuditEvent category records create, update and delete operations on runbooks, jobs and assets with the caller's object ID and app ID, but scrubs client IP and principal name; the Azure Activity log carries the caller and client IP, so use both.

EventSourceWhy it matters
Runbook created, updated or published (Microsoft.Automation/automationAccounts/runbooks/write)Activity log; AuditEvent (targetResources_Resource_s Runbook)Code change that will run as the identity; alert outside the release pipeline
Webhook created (.../webhooks/write)Activity logNew unauthenticated trigger; a classic persistence step
Schedule created or linked (.../schedules/write, .../jobSchedules/write)Activity logRecurring execution added
Credential or variable changedAuditEvent (Credential, Variables)Secret replaced or added outside change
Hybrid worker or worker group registered (.../hybridRunbookWorkerGroups/write)Activity logNew machine that will execute jobs
Role assignment to the account's identity (Microsoft.Authorization/roleAssignments/write)Activity logPrivilege growth of the automation identity
Job started, failed or suspendedJobLogs (ResultType, RunbookName_s, Caller_s)Jobs started at odd times or by unexpected callers
Job error and output streamsJobStreamsErrors from a tampered runbook; secrets accidentally printed
Managed identity sign-insEntra managed identity sign-in logsIdentity used against resources it does not normally touch

Metrics that show the programme is working:

  • Broad identities: number of Automation identities holding Owner, Contributor or User Access Administrator at subscription or management group scope (target zero).
  • Standing editors: permanent (non-PIM) holders of Automation Contributor, Contributor or Owner on Automation accounts.
  • Webhook hygiene: webhooks with expiry beyond your policy, and webhooks not triggered in 90 days.
  • Untracked change: runbook writes not matched to a pipeline run or change ticket.
  • Worker estate: share of hybrid workers on the extension-based platform, and workers on domain controllers (target zero).
FrameworkReferenceRelevance
MITRE ATT&CKT1651 Cloud Administration CommandAbuse of cloud management services to run code on managed machines
MITRE ATT&CKT1078.004 Cloud AccountsMisuse of a valid cloud identity such as the account's managed identity
MITRE ATT&CKT1098.003 Additional Cloud RolesGranting extra roles to an automation identity
NIST SP 800-53 Rev 5AC-6, AC-2, CM-6, AU-6, SC-7Least privilege, account management, configuration, log review, boundary protection
NIST CSF 2.0PR.AA-05, DE.CM-01Access permissions managed and reviewed; networks and services monitored

Common failure patterns

  • Copying Run As roles wholesale: the migration script carried the default subscription Contributor role onto the managed identity, so the retirement changed the credential but not the privilege.
  • Developers as Contributor on the account: engineers given Contributor to "fix a runbook" can now run code as an identity with production rights, with no PIM approval.
  • Secrets in output: a debugging line writes a password or token to job output, readable by every operator and kept in Log Analytics.
  • Long-lived webhooks in tickets and templates: URLs pasted into chat, wiki pages or template outputs remain valid for their full expiry.
  • Workers on sensitive servers: a hybrid worker installed on a domain controller or management server for convenience turns any runbook author into an operator of that server.
  • No AuditEvent logging: diagnostic settings were never configured, so runbook and asset changes can only be reconstructed from the Activity log, without asset names.

Practitioner checklist

  • Inventory every Automation account with owner, identity, role assignments, webhooks and hybrid worker groups.
  • Confirm no runbook depends on Run As and delete leftover Run As applications and certificates.
  • Reduce each managed identity to the actions and scopes its runbooks need; remove subscription-scope Contributor and Owner.
  • Make Automation Contributor, Contributor and Owner PIM-eligible; give operators Automation Operator or Job Operator plus Runbook Operator.
  • Store secrets as encrypted assets or in Key Vault; remove any print of secrets from runbooks.
  • Set short webhook expiry, validate requests in the runbook and delete unused webhooks.
  • Move hybrid workers to the extension-based platform, off domain controllers, with restricted host access.
  • Use private endpoints and disable public network access for accounts with high-privilege identities.
  • Enable diagnostic settings for JobLogs, JobStreams and AuditEvent and alert on runbook, webhook, schedule, worker and role changes.

Standards and references

Related NHI Mgmt Group resources: Microsoft Azure Security Guide · Azure Managed Identities Security Guide · Azure Logic Apps Security · Azure Security Checklist

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.