1. Resources
  2. Detection rules
  3. Azure Automation Runbook Changed or Started

Azure Automation Runbook Changed or Started detection rules

Someone creates, edits, publishes or starts an Azure Automation runbook, running code as the Automation account's managed identity, which often holds broad Azure roles.

Platform
Azure
Severity
High
Log source
Azure Activity log
Last updated
MITRE ATT&CK technique
T1648Serverless Execution
Tactic
Execution
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Write access to the Automation account, such as Contributor or Automation Contributor, or Automation Operator to start existing runbooks.
Impact
Code execution with the roles of the Automation account's identity, often Contributor or Owner over subscriptions, and persistence through schedules and webhooks.
Response
Stop the runbook's running jobs and disable its schedules and webhooks, then remove the caller's role and restore the runbook from source control.
Mitigation
Give Automation account identities only the roles their runbooks need, scoped as narrowly as possible, and manage runbooks from source control with review.
Operations
MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/LISTKEYS/ACTIONMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/AGENTREGISTRATIONINFORMATION/REGENERATEKEY/ACTIONMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CREDENTIALS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/VARIABLES/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CERTIFICATES/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CONNECTIONS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CONFIGURATIONS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/COMPILATIONJOBS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/NODECONFIGURATIONS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/HYBRIDRUNBOOKWORKERS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/HYBRIDRUNBOOKWORKERS/MOVE/ACTIONand 12 more in the rules below
Threat groups
None listed in MITRE ATT&CK for this technique

How the attack works

Azure Automation runs PowerShell and Python runbooks in Azure-hosted sandboxes or on Hybrid Runbook Workers. Runbooks authenticate to Azure with the Automation account's system-assigned or user-assigned managed identity, which is often given Contributor or broader roles so that it can manage resources on a schedule. Microsoft warns that the Automation Contributor role can reach any resource the account's identity can.

An attacker who can write to an Automation account adds a runbook or edits an existing one, publishes it, and then starts it, runs it as a test job, or links it to a schedule or webhook. The code runs with the managed identity's permissions rather than the attacker's, and a schedule or webhook keeps it running later. Each of these changes and manual starts is an Azure Resource Manager operation recorded in the activity log with its caller. The same result is reached without an edit of a runbook by changing what runbooks load or read: a module, a Python package, the source control configuration that synchronizes runbooks from a repository, or a shared asset such as a variable or a connection. Further rules on this page match those writes, DSC configuration changes and the listing of the account's registration keys. One more rule matches the registration of a Hybrid Runbook Worker and changes to worker groups. Microsoft documents that jobs on a hybrid worker run on the machine itself, under the local System account on Windows or the nxautomation account on Linux, so a new worker is a server on which the runbooks of the account will execute.

What an attacker needs

  • Write access to the Automation account to change runbooks (Owner, Contributor, Automation Contributor), or Automation Operator or Automation Job Operator to start existing runbooks.

Impact

Code execution with the roles of the Automation account's identity, often Contributor or Owner over subscriptions, and persistence through schedules and webhooks that run it again later.

Detection rules

Azure Automation Account Keys Listed or Regenerated

Detects a successful listing of the keys of an Azure Automation account (Microsoft.Automation/automationAccounts/listKeys/action) or a regeneration of its registration key (agentRegistrationInformation/regenerateKey/action). Microsoft documents the primary and secondary access key as the registration key with which a machine registers with the account's State Configuration service. A caller that reads the keys can register a machine of its own, and a regeneration prevents further registrations with the previous key. Reading the keys is also a step of registering machines legitimately, so baseline the callers.

LevelLowStatusExperimentalLog sourceAzure Activity log
title: Azure Automation Account Keys Listed or Regenerated
id: 2bc5236a-e71d-484b-8cc3-b851c8975185
status: experimental
description: >-
  Detects a successful listing of the keys of an Azure Automation account
  (Microsoft.Automation/automationAccounts/listKeys/action) or a regeneration
  of its registration key
  (agentRegistrationInformation/regenerateKey/action). Microsoft documents the
  primary and secondary access key as the registration key with which a
  machine registers with the account's State Configuration service. A caller
  that reads the keys can register a machine of its own, and a regeneration
  prevents further registrations with the previous key. Reading the keys is
  also a step of registering machines legitimately, so baseline the callers.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/rest/api/automation/keys/list-by-automation-account
  - https://learn.microsoft.com/en-us/azure/automation/automation-dsc-onboarding
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-18
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/LISTKEYS/ACTION
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/AGENTREGISTRATIONINFORMATION/REGENERATEKEY/ACTION
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Administrators and onboarding scripts that read the registration key to register machines, and planned key regeneration. Exclude the onboarding identities in a filter_ selection by Caller once confirmed.
level: low

False positives

  • Administrators and onboarding scripts that read the registration key to register machines, and planned key regeneration. Exclude the onboarding identities in a filter_ selection by Caller once confirmed.

Azure Automation Credential, Variable, Certificate or Connection Asset Written

Detects a successful create or update of a credential, variable, certificate or connection asset in an Azure Automation account. Runbooks and DSC configurations read these shared assets when they run, so a changed variable or connection changes what an unchanged runbook does and which identity or target it uses. The Activity log event does not contain the value that was written. The rule matches routine asset maintenance as well, so use it for review together with the runbook rules on this page and not as an alert on its own.

LevelLowStatusExperimentalLog sourceAzure Activity log
title: Azure Automation Credential, Variable, Certificate or Connection Asset Written
id: f3968a56-7578-4676-9ae8-89f4ea6316eb
status: experimental
description: >-
  Detects a successful create or update of a credential, variable, certificate
  or connection asset in an Azure Automation account. Runbooks and DSC
  configurations read these shared assets when they run, so a changed variable
  or connection changes what an unchanged runbook does and which identity or
  target it uses. The Activity log event does not contain the value that was
  written. The rule matches routine asset maintenance as well, so use it for
  review together with the runbook rules on this page and not as an alert on
  its own.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/azure/automation/shared-resources/credentials
  - https://learn.microsoft.com/en-us/azure/automation/shared-resources/variables
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-18
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CREDENTIALS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/VARIABLES/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CERTIFICATES/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CONNECTIONS/WRITE
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Credential and certificate rotation, and variables that are updated by deployment pipelines. Exclude those identities in a filter_ selection by Caller once confirmed.
level: low

False positives

  • Credential and certificate rotation, and variables that are updated by deployment pipelines. Exclude those identities in a filter_ selection by Caller once confirmed.

Azure Automation DSC Configuration Written or Compiled

Detects a successful write of a Desired State Configuration (DSC) configuration, a compilation job or a node configuration in Azure Automation State Configuration. The service is a DSC pull server, and the machines that are registered with it receive the configurations assigned to them and conform to them, so a changed configuration changes those machines. The Activity log event does not contain the configuration, so compare it with its source. Microsoft has announced the retirement of Azure Automation State Configuration for 30 September 2027, so accounts that never used it should not produce this event at all.

LevelLowStatusExperimentalLog sourceAzure Activity log
title: Azure Automation DSC Configuration Written or Compiled
id: 508452c1-143a-436e-8986-4ff409225910
status: experimental
description: >-
  Detects a successful write of a Desired State Configuration (DSC)
  configuration, a compilation job or a node configuration in Azure Automation
  State Configuration. The service is a DSC pull server, and the machines that
  are registered with it receive the configurations assigned to them and
  conform to them, so a changed configuration changes those machines. The
  Activity log event does not contain the configuration, so compare it with
  its source. Microsoft has announced the retirement of Azure Automation State
  Configuration for 30 September 2027, so accounts that never used it should
  not produce this event at all.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-18
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/CONFIGURATIONS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/COMPILATIONJOBS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/NODECONFIGURATIONS/WRITE
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Configuration management teams and pipelines that publish and compile DSC configurations. Exclude their identities in a filter_ selection by Caller once confirmed.
level: low

False positives

  • Configuration management teams and pipelines that publish and compile DSC configurations. Exclude their identities in a filter_ selection by Caller once confirmed.

Hybrid Runbook Worker Registered or Worker Group Changed

Detects a successful create or update of a Hybrid Runbook Worker group in an Azure Automation account, the registration of a machine as a Hybrid Runbook Worker in a group, or the move of a worker to another group. Jobs that target a worker group run on its member machines, and Microsoft documents that they run under the local System account on Windows or the nxautomation account on Linux. A new worker is therefore a server on which whoever controls the runbooks of the account executes code with system rights, and a job on it can still use the managed identity and the assets of the Automation account. Onboarding a server is the legitimate cause, and it is rare enough to review each time.

LevelMediumStatusExperimentalLog sourceAzure Activity log
title: Hybrid Runbook Worker Registered or Worker Group Changed
id: 549f9915-69aa-4f13-926f-3f278735afc4
status: experimental
description: >-
  Detects a successful create or update of a Hybrid Runbook Worker group in
  an Azure Automation account, the registration of a machine as a Hybrid
  Runbook Worker in a group, or the move of a worker to another group. Jobs
  that target a worker group run on its member machines, and Microsoft
  documents that they run under the local System account on Windows or the
  nxautomation account on Linux. A new worker is therefore a server on which
  whoever controls the runbooks of the account executes code with system
  rights, and a job on it can still use the managed identity and the assets
  of the Automation account. Onboarding a server is the legitimate cause, and
  it is rare enough to review each time.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/azure/automation/automation-hybrid-runbook-worker
  - https://learn.microsoft.com/en-us/azure/automation/automation-hrw-run-runbooks
  - https://learn.microsoft.com/en-us/azure/automation/extension-based-hybrid-runbook-worker-install
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-18
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/HYBRIDRUNBOOKWORKERS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/HYBRIDRUNBOOKWORKERS/MOVE/ACTION
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Planned onboarding of Azure virtual machines and Azure Arc-enabled servers as Hybrid Runbook Workers, and the migration from agent-based to extension-based workers. Match each event to a change record and exclude the onboarding identity in a filter_ selection by Caller once confirmed.
level: medium

False positives

  • Planned onboarding of Azure virtual machines and Azure Arc-enabled servers as Hybrid Runbook Workers, and the migration from agent-based to extension-based workers. Match each event to a change record and exclude the onboarding identity in a filter_ selection by Caller once confirmed.

Azure Automation Module, Python Package or Source Control Changed

Detects a successful create or update of a PowerShell module, a Python package or a source control configuration in an Azure Automation account. Runbooks load the account's modules and packages when they run, and source control synchronization replaces runbooks with the scripts of a repository, so each of these changes what runs with the Automation account's managed identity without an edit of a runbook. The Activity log event does not contain the module, the package or the repository address. Packages that are managed through runtime environments have no operation in Microsoft's permissions reference and are not matched.

LevelMediumStatusExperimentalLog sourceAzure Activity log
title: Azure Automation Module, Python Package or Source Control Changed
id: 0953235f-b213-40b8-9615-e4623e9a7573
status: experimental
description: >-
  Detects a successful create or update of a PowerShell module, a Python
  package or a source control configuration in an Azure Automation account.
  Runbooks load the account's modules and packages when they run, and source
  control synchronization replaces runbooks with the scripts of a repository,
  so each of these changes what runs with the Automation account's managed
  identity without an edit of a runbook. The Activity log event does not
  contain the module, the package or the repository address. Packages that
  are managed through runtime environments have no operation in Microsoft's
  permissions reference and are not matched.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/azure/automation/shared-resources/modules
  - https://learn.microsoft.com/en-us/azure/automation/source-control-integration
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-18
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/MODULES/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/PYTHON2PACKAGES/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/PYTHON3PACKAGES/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/SOURCECONTROLS/WRITE
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Module and package updates by the automation team, and the first setup of source control integration. Correlate with change records and exclude the maintaining identities in a filter_ selection by Caller.
level: medium

False positives

  • Module and package updates by the automation team, and the first setup of source control integration. Correlate with change records and exclude the maintaining identities in a filter_ selection by Caller.

Azure Automation Runbook Created, Edited or Published

Detects a successful creation or update of an Azure Automation runbook, a change to its draft or draft content, or the publishing of a draft. Runbooks run with the Automation account's managed identity.

LevelMediumStatusExperimentalLog sourceAzure Activity log
title: Azure Automation Runbook Created, Edited or Published
id: e680f2d1-8987-4a22-ab32-17a739b5669b
status: experimental
description: >-
  Detects a successful creation or update of an Azure Automation runbook, a
  change to its draft or draft content, or the publishing of a draft. Runbooks
  run with the Automation account's managed identity.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/azure/automation/automation-role-based-access-control
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-10
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/CONTENT/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/PUBLISH/ACTION
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Runbook maintenance by the automation team or source control synchronization; exclude those identities in a filter_ selection by Caller.
level: medium

False positives

  • Runbook maintenance by the automation team or source control synchronization; exclude those identities in a filter_ selection by Caller.

Azure Automation Runbook Started or Given a Trigger

Detects a successful manual start of an Azure Automation job, a draft test job, or the creation of a webhook or job schedule that will start a runbook later. The runbook runs with the Automation account's managed identity.

LevelLowStatusExperimentalLog sourceAzure Activity log
title: Azure Automation Runbook Started or Given a Trigger
id: 87aaa8c4-5ce1-48d3-ac87-b0190e80e93e
status: experimental
description: >-
  Detects a successful manual start of an Azure Automation job, a draft test
  job, or the creation of a webhook or job schedule that will start a runbook
  later. The runbook runs with the Automation account's managed identity.
references:
  - https://attack.mitre.org/techniques/T1648/
  - https://learn.microsoft.com/en-us/azure/automation/automation-role-based-access-control
  - https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-10
tags:
  - attack.execution
  - attack.t1648
logsource:
  product: azure
  service: activitylogs
detection:
  selection:
    OperationNameValue:
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/TESTJOB/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/WEBHOOKS/WRITE
      - MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBSCHEDULES/WRITE
    ActivityStatusValue:
      - Success
      - Succeeded
  condition: selection
falsepositives:
  - Operators who start runbooks by hand and pipelines that link schedules or webhooks; exclude known operator and pipeline identities in a filter_ selection by Caller.
level: low

False positives

  • Operators who start runbooks by hand and pipelines that link schedules or webhooks; exclude known operator and pipeline identities in a filter_ selection by Caller.

Detection logic

Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.

Runbook changed and started by the same caller within a short time

Detection hypothesisSequence of eventsNeeds your own lists

Maintenance of a runbook and its execution are usually separate: a pipeline or an engineer publishes, and a schedule starts the job later. A caller that edits or publishes a runbook and starts it by hand a few minutes later is using the runbook as a way to run its own code with the Automation account's identity.

  1. In the Azure Activity log, a runbook is changed with status Success: MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/WRITE, RUNBOOKS/DRAFT/WRITE, RUNBOOKS/DRAFT/CONTENT/WRITE or RUNBOOKS/PUBLISH/ACTION. Keep the Caller and the Automation account from the resource ID.
  2. Within 30 minutes the same Caller starts a job in the same Automation account: MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBS/WRITE or RUNBOOKS/DRAFT/TESTJOB/WRITE.
  3. From the start time onward, review the Activity log events made by the Automation account's managed identity. Take the object ID of that identity from the Automation account, because the log does not link a job to the identity it ran with.

EventsMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/CONTENT/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/PUBLISH/ACTIONMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/TESTJOB/WRITE

LimitsEngineers who develop a runbook edit and test it in the same session, so the pattern is normal in development accounts and for the automation team, whose identities have to be excluded by name. The 30 minutes are a starting point. A runbook that is changed and then started by its schedule or a webhook does not match.

Hybrid Runbook Worker registered and a job started by the same caller shortly after

Detection hypothesisSequence of events

Workers are registered when a server is onboarded, and jobs are started later by schedules or operators. A caller that registers a machine as a Hybrid Runbook Worker, or creates a worker group, and starts a job in the same Automation account a few minutes later is using the account to run code on that machine with system rights.

  1. In the Azure Activity log, a worker or a worker group is written with status Success: MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/HYBRIDRUNBOOKWORKERS/WRITE or HYBRIDRUNBOOKWORKERGROUPS/WRITE. Keep the Caller, the Automation account and the group.
  2. Within 60 minutes the same Caller starts a job in the same Automation account: MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBS/WRITE.
  3. Read the job in the Automation account to learn which runbook it ran and whether it ran on the new worker group, because the Activity log event does not say where a job runs.

EventsMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/HYBRIDRUNBOOKWORKERS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/HYBRIDRUNBOOKWORKERGROUPS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBS/WRITE

LimitsAn engineer who onboards a server as a worker and runs a test job on it looks the same, so the automation team has to be excluded by name. The 60 minutes are a starting point. A job that a schedule or a webhook sends to the new group later does not match.

New Automation account whose identity gets a role and a runbook within a day

Detection hypothesisSequence of eventsJoins two logsNeeds a baseline

Changing an Automation account that others maintain draws attention, so an attacker who wants a lasting way to run code as a privileged identity can build a new one: create an account, give its managed identity a role, and publish a runbook with a schedule or a webhook. Each step is ordinary on its own. Together, within a day and with the account and the runbook from the same caller, they describe a new path to run code with that role.

  1. In the Azure Activity log, take a successful MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/WRITE for an account with no earlier events. The operation also updates accounts, so only a first write is a creation. Keep the Caller and the account.
  2. Read the principal ID of the account's managed identity from the account. Within 24 hours, look for the start event of MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE whose request body in Properties has that PrincipalId.
  3. In the same 24 hours, look for RUNBOOKS/PUBLISH/ACTION, WEBHOOKS/WRITE or JOBSCHEDULES/WRITE under MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS in the new account, by the same Caller as the creation.

EventsMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/WRITEMICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/PUBLISH/ACTIONMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/WEBHOOKS/WRITEMICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/JOBSCHEDULES/WRITE

LimitsA platform team that sets up a new Automation account through infrastructure-as-code produces the same steps, so its deployment identities have to be excluded by name. An account created before the look-back looks like an update and is missed. A user-assigned identity attached to the account has its own principal ID to check. The 24 hours are a starting point.

Triage

  • Identify the Caller, the Automation account and the runbook from the event, and whether the caller normally maintains runbooks.
  • Compare the runbook content with its previous version or source control, and review job output and streams for recent runs.
  • Review activity by the Automation account's managed identity after the change.

Response

Once the attack is confirmed:

  1. Stop the running jobs of the runbook and disable or delete the schedules and webhooks linked to it, so the code is not started again while you work.
  2. Remove the caller's role on the Automation account, revoke its sessions and rotate its credentials. If the caller is a service principal or a pipeline identity, remove the secrets and certificates on it that you cannot account for.
  3. Restore the runbook from source control or the last known good version and publish it again. Delete the runbooks that the attacker created.
  4. Undo what the Automation account's managed identity did from the first changed run onward. Role assignments, new credentials and new resources created by that identity come first.
  5. Rotate the credentials, certificates, connections and encrypted variables stored as assets in the Automation account. A runbook can read them, so treat them as exposed.
  6. Before you enable schedules and webhooks again, confirm that every published runbook matches source control and that only the expected schedules, webhooks and job schedules remain.

Mitigation

  • Give Automation account identities only the roles their runbooks need, scoped as narrowly as possible.
  • Restrict Contributor and Automation Contributor on Automation accounts and manage runbooks from source control with review.
  • Review schedules and webhooks regularly and remove the ones that are no longer used.

Frequently asked questions

Does the Azure Activity log show what the runbook code did?

No. The Activity log records the operation on the runbook, job, schedule or webhook and its caller, not the script or its effects. Compare the runbook with its previous version, read the job output and streams, and review the activity of the Automation account's managed identity after the change.

Does removing the attacker's access to the Automation account stop a runbook they scheduled?

No. A schedule or webhook that is linked to the runbook keeps starting it, and the code runs with the permissions of the managed identity, not with the attacker's. Remove the schedules and webhooks you cannot explain and restore the runbook before you consider the access closed.

Which roles can start a runbook without being able to edit it?

Automation Operator and Automation Job Operator can start existing runbooks, while Owner, Contributor and Automation Contributor can also change them. A start by an operator still runs the runbook with the managed identity's permissions, so the rule on starts and triggers is worth a baseline per caller.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.