SOP-112: Azure Automation Runbook & Logic App Abuse Response

·

Azure Automation and Logic Apps are the two most common "serverless" execution surfaces in an Azure tenant, and both run under a workload identity that usually holds far more privilege than the human who triggers them. An attacker who gains write access to an Automation account can import an arbitrary PowerShell or Python runbook, publish it, and start a job that executes under the account's managed identity — no interactive sign-in, no user MFA, no Conditional Access. The same account can be turned into durable persistence by attaching a webhook (an unauthenticated HTTPS trigger reachable from anywhere on the internet) or a recurring schedule that re-creates a backdoor on a cron cadence long after the attacker's original credentials are revoked.

This SOP treats a runbook or Logic App write outside a change window as a SEV1 candidate: the same primitives that automate patching also automate credential theft and role escalation. Key data sources: AzureActivity (management-plane runbook/webhook/schedule/workflow writes and role assignments), AzureDiagnostics (JobLogs / JobStreams runbook output, Logic App WorkflowRuntime), and AuditLogs (Entra role grants to the managed identity or service principal). MITRE ATT&CK: T1648 Serverless Execution, T1546 Event Triggered Execution, T1098.003 Additional Cloud Roles.

☰ Table of Contents

01 Background 02 Identification 03 Containment 04 Eradication 05 Escalation
☁

01 — BACKGROUND

TECHNIQUE OVERVIEW
01
Technique Overview — Serverless Execution & Persistence
MITRE T1648 / T1546

An Azure Automation account is a hosted job engine: it stores runbooks (PowerShell, PowerShell Workflow, or Python scripts), executes them on Microsoft-managed sandboxes or a Hybrid Runbook Worker, and authenticates to Azure and Microsoft Graph using either a legacy Run As service principal or, on modern accounts, a system- or user-assigned managed identity. Because operators grant these identities broad rights so automation "just works" — frequently Contributor at subscription scope, sometimes Owner or User Access Administrator — the identity behind a runbook is often more privileged than any single human. Logic Apps follow the same pattern: a low-code workflow with an HTTP-request trigger and a managed identity that can reach Key Vault, Storage, or Exchange Online through built-in connectors.

Three properties make these services attractive to an intruder. First, execution is non-interactive — a runbook job or a workflow run produces no user sign-in, bypassing MFA and most Conditional Access. Second, they are natively persistent — a webhook or schedule keeps firing after the human credential is burned. Third, the output surface (JobStreams) is often not monitored, so credential dumps and role grants performed inside a runbook go unseen unless diagnostic logging is enabled and shipped to the SIEM.

FieldValue
MITRE TechniqueT1648 — Serverless Execution
T1546 — Event Triggered Execution (webhook / schedule trigger)
T1098.003 — Account Manipulation: Additional Cloud Roles (managed-identity grant)
T1078.004 — Valid Accounts: Cloud Accounts (identity re-use)
Kill-chain PhaseExecution · Persistence · Privilege Escalation
Primary Log SourceAzureActivity (management plane), AzureDiagnostics (JobLogs / JobStreams, WorkflowRuntime)
Secondary Log SourcesAuditLogs (Entra role grants to SP/MI), AADServicePrincipalSignInLogs (MI token use), MicrosoftGraphActivityLogs
Resource ProvidersMicrosoft.Automation, Microsoft.Logic, Microsoft.Authorization
Default SeveritySEV1 candidate — runbook/workflow write outside a change window; webhook creation = confirmed persistence
Detection Window24 hours for execution; extend webhook/schedule/role-grant hunts to 7–30 days

Common attack paths

#PathWhat the analyst sees
A1Malicious runbook execution — attacker imports/edits a runbook, publishes, starts a job; code runs under the MI to enumerate, dump Key Vault, or add a rolerunbooks/write + runbooks/publish/action + jobs/write in quick succession; JobStreams containing Get-AzKeyVaultSecret / New-AzRoleAssignment
A2Webhook persistence — attacker creates a webhook on a runbook; the URL triggers execution over unauthenticated HTTPS from anywherewebhooks/write; later jobs with no corresponding interactive caller
A3Schedule persistence — a recurring schedule re-runs a backdoor runbook (re-adds an admin, re-grants a role) on a cron cadenceschedules/write + jobSchedules/write linking schedule → runbook
A4Managed-identity privilege grant — attacker grants the Automation MI Owner/Contributor/UAA so the runbook can do anythingroleAssignments/write to the MI object ID; AuditLogs "Add app role assignment to service principal"
A5Logic App workflow abuse — HTTP-triggered Logic App with a Key Vault / Office 365 connector exfiltrates secrets or mail under the workflow MIMicrosoft.Logic/workflows/write; WorkflowRuntime trigger from an unexpected client IP

A managed identity is a machine account with no MFA and, by default, no Conditional Access. A runbook that adds a role assignment to itself or to a new principal is silent privilege escalation — treat any roleAssignments/write initiated from an Automation context as CRITICAL until proven part of a documented deployment.

🔍

02 — IDENTIFICATION

6 INDICATORS + IOC
▶ Investigation Workflow
T0
Alert Triage Checklist
TRIAGE

Answer these five questions before running deep queries. Any single YES in rows 1–4 pushes this to active investigation; row 5 sets your urgency ceiling.

  • 1Was a runbook, webhook, schedule, or Logic App workflow written outside a known deployment window? Cross-check your change calendar / CI pipeline for a matching release.
  • 2Did the same principal that wrote the runbook also start a job and/or grant a role? Write → publish → run → role-grant in one short burst is the classic abuse chain.
  • 3Is the caller a human user rather than a deployment service principal? A named user hand-editing production automation at 02:00 is an outlier; a pipeline SP is expected.
  • 4Is the CallerIpAddress a new / non-corporate / cloud-hosting IP or a Tor/anonymiser ASN? Pivot to SOP-36 for anonymiser confirmation.
  • 5What is the blast radius of the identity? Determine the Automation account MI / Run As role scope now — Owner or Contributor at subscription scope makes this CRITICAL regardless of the observed action.

Before anything else, call the Automation account owner listed on the resource tags. Ninety percent of "runbook changed" alerts are a scheduled deployment; the fast confirmation is a human who says "yes, that was my release at 14:00." No owner answer within the SLA = treat as unauthorised and proceed.

I1
Runbook Create / Modify / Publish
T1648
WHY CHECK

The abuse chain begins with getting attacker code into the account. An attacker imports a new runbook or edits the draft of an existing one, then publishes it so it becomes runnable. A write-then-publish pair on a production runbook by a human user, with no matching change ticket, is the first high-signal event.

📍 Portal Navigation — Microsoft Sentinel / Log Analytics
portal.azure.com› Microsoft Sentinel› Logs› AzureActivity
  • 1Open Microsoft Sentinel → Logs (or Log Analytics → Logs) and confirm the AzureActivity table is receiving data for the affected subscription.
  • 2Run the KQL below over the last 24 hours. For each hit note Caller, CallerIpAddress, and the target runbook in _ResourceId.
  • 3In parallel open Automation Accounts → [account] → Runbooks, click the runbook, and review the Source control / Modified timestamp and the runbook body for suspicious cmdlets.
  • 4Correlate the write time against your change / release calendar. A publish with no ticket and a human caller is a confirmed anomaly — move to I2.
Operation (OperationNameValue)MeaningSeverity
.../RUNBOOKS/DRAFT/WRITERunbook draft content written / replaced — code stagedHIGH
.../RUNBOOKS/WRITERunbook object created or updatedHIGH
.../RUNBOOKS/PUBLISH/ACTIONDraft promoted to published — now executableCRITICAL
.../RUNBOOKS/DRAFT/CONTENT/WRITERaw script content of the draft modifiedCRITICAL
DETECTS: creation, modification, or publishing of Automation runbooks — the code-insertion step of the abuse chain
KQL — Microsoft Sentinel / Log Analytics
AzureActivity | where TimeGenerated > ago(24h) | where OperationNameValue in~ ( "MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/WRITE", "MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/WRITE", "MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/CONTENT/WRITE", "MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/PUBLISH/ACTION") | where ActivityStatusValue in ("Success","Succeeded","Started","Accepted") | extend CallerIP = tostring(CallerIpAddress) | project TimeGenerated, Caller, CallerIP, OperationNameValue, ResourceGroup, _ResourceId | order by TimeGenerated asc
DETECTS: same runbook write/publish operations in Splunk via the Microsoft Azure add-on
SPL — Splunk
index=azure sourcetype="azure:activity" (operationName="MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/WRITE" OR operationName="MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/WRITE" OR operationName="MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/DRAFT/CONTENT/WRITE" OR operationName="MICROSOFT.AUTOMATION/AUTOMATIONACCOUNTS/RUNBOOKS/PUBLISH/ACTION") (status=Success OR status=Succeeded OR status=Started OR status=Accepted) | table _time caller callerIpAddress operationName resourceGroupName resourceId | sort _time

The runbook body is only visible in AzureActivity as an operation name, not as content — the actual script is not in the log. You must open the runbook in the portal (or export it via Export-AzAutomationRunbook) to read what it does. Never verdict on the operation name alone.

I2
Runbook Job Execution & Job-Stream Output
T1648
WHY CHECK

Writing a runbook is harmless until it runs. A jobs/write event starts execution under the account's managed identity. The job's output — captured in AzureDiagnostics JobStreams when diagnostic logging is enabled — is where you actually see what the code did: secret reads, role grants, outbound web calls, or credential material.

📍 Portal Navigation — Automation Jobs & Diagnostics
portal.azure.com› Automation Accounts› [account]› Jobs
  • 1Open Automation Accounts → [account] → Jobs. Sort by Start time and locate jobs correlating to the I1 write. Click a job → All Logs / Output / Error / Streams.
  • 2If the account has diagnostic settings shipping to Log Analytics, run the JobStreams KQL below to pull output centrally without per-job clicking.
  • 3Read the output for high-risk cmdlets — Get-AzKeyVaultSecret, New-AzRoleAssignment, Add-AzADGroupMember, Invoke-WebRequest, Invoke-RestMethod, DownloadString, base64 blobs.
  • 4Note the RunOn target — a job forced onto a Hybrid Runbook Worker can pivot into on-prem or a VNet the sandbox cannot reach.
Output Signal (in JobStreams)MeaningSeverity
Get-AzKeyVaultSecret / listKeysRunbook is dumping Key Vault secrets or storage keysCRITICAL
New-AzRoleAssignmentRunbook is granting RBAC roles — self-escalationCRITICAL
Add-AzADGroupMember / New-AzADUserDirectory manipulation — backdoor account/groupCRITICAL
Invoke-WebRequest / DownloadStringOutbound fetch of a second-stage payload or exfilHIGH
[Convert]::FromBase64StringEncoded payload being decoded in-runbookHIGH
DETECTS: runbook job starts, and job-stream output containing credential-access / role-grant / download indicators
KQL — Job start (AzureActivity)
AzureActivity | where TimeGenerated > ago(24h) | where OperationNameValue has "AUTOMATIONACCOUNTS/JOBS/WRITE" | project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceGroup, _ResourceId | order by TimeGenerated asc
KQL — Job output (AzureDiagnostics JobStreams / JobLogs)
AzureDiagnostics | where TimeGenerated > ago(24h) | where ResourceProvider == "MICROSOFT.AUTOMATION" | where Category in ("JobStreams","JobLogs") | where ResultDescription has_any ( "Get-AzKeyVaultSecret","listKeys","New-AzRoleAssignment","Add-AzADGroupMember", "New-AzADUser","Invoke-WebRequest","Invoke-RestMethod","DownloadString", "FromBase64String","ConvertTo-SecureString") | project TimeGenerated, RunbookName_s, JobId_g, StreamType_s, ResultDescription | order by TimeGenerated asc
DETECTS: Splunk equivalents — job starts plus job-stream output carrying the same high-risk indicators
SPL — Splunk
index=azure sourcetype="azure:activity" operationName="*AUTOMATIONACCOUNTS/JOBS/WRITE" | table _time caller callerIpAddress operationName resourceId | sort _time ``` then correlate job output: index=azure sourcetype="azure:diagnostic" ResourceProvider="MICROSOFT.AUTOMATION" (Category=JobStreams OR Category=JobLogs) | search ResultDescription IN ("*Get-AzKeyVaultSecret*","*New-AzRoleAssignment*","*Add-AzADGroupMember*","*Invoke-WebRequest*","*DownloadString*","*FromBase64String*") | table _time RunbookName JobId StreamType ResultDescription | sort _time

If AzureDiagnostics returns nothing, the account almost certainly has no diagnostic setting shipping JobStreams — the output is invisible to the SIEM. Do not read "0 hits" as "clean." Read the job output directly in the portal and enable diagnostic logging as a permanent fix (see Eradication).

I3
Webhook Creation — Unauthenticated Trigger Persistence
T1546
WHY CHECK

A webhook is an HTTPS URL containing a token that starts a runbook when called — with no Azure authentication. Anyone holding the URL can trigger the runbook from anywhere on the internet, and the URL secret is only shown once at creation. A webhook on a sensitive runbook is durable persistence that survives revocation of the attacker's Azure credentials.

📍 Portal Navigation — Automation Webhooks
portal.azure.com› Automation Accounts› [account]› Webhooks
  • 1Run the KQL below over the last 7 days — webhook creation is rare, so any hit warrants review.
  • 2Open Automation Accounts → [account] → Webhooks and review each webhook's linked runbook, expiry date, and creation time.
  • 3A webhook pointing at a newly-written runbook (I1), or with a far-future expiry, or created by a human off-hours, is a confirmed persistence artifact — disable it in Containment.
  • 4Correlate webhook-triggered jobs: jobs in the Jobs list with no interactive caller and a source of "Webhook" indicate the trigger has already fired.
DETECTS: creation of a webhook on any runbook — an internet-reachable, unauthenticated execution trigger
KQL — Microsoft Sentinel / Log Analytics
AzureActivity | where TimeGenerated > ago(7d) | where OperationNameValue has "AUTOMATIONACCOUNTS/WEBHOOKS/WRITE" | where ActivityStatusValue in ("Success","Succeeded","Accepted") | project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceGroup, _ResourceId | order by TimeGenerated desc
DETECTS: same webhook-creation operation in Splunk
SPL — Splunk
index=azure sourcetype="azure:activity" operationName="*AUTOMATIONACCOUNTS/WEBHOOKS/WRITE" (status=Success OR status=Succeeded OR status=Accepted) | table _time caller callerIpAddress operationName resourceGroupName resourceId | sort -_time

Webhook URLs are secrets that Azure never shows again after creation. You cannot "read" an existing webhook's URL to confirm it is compromised — assume any unauthorised webhook is leaked and delete it. Deleting the webhook invalidates the URL immediately.

I4
Schedule-Based Persistence
T1546
WHY CHECK

A schedule linked to a runbook re-runs it automatically — hourly, daily, or on a custom cadence. An attacker uses this to make a backdoor self-healing: even if you remove a rogue admin or role, the scheduled runbook re-creates it on the next tick. Detecting the schedule link (jobSchedules/write) is what stops the whack-a-mole.

📍 Portal Navigation — Automation Schedules
portal.azure.com› Automation Accounts› [account]› Schedules
  • 1Run the KQL below over the last 7 days for schedule and job-schedule writes.
  • 2Open Automation Accounts → [account] → Schedules; for each schedule check Linked runbooks and the recurrence.
  • 3A new schedule linked to a suspect runbook (I1), a high-frequency recurrence (every hour), or an odd start time is a persistence signal.
  • 4Cross-reference with I3 — attackers frequently attach both a webhook and a schedule for redundancy.
DETECTS: creation of a schedule or a schedule-to-runbook link — recurring automatic re-execution persistence
KQL — Microsoft Sentinel / Log Analytics
AzureActivity | where TimeGenerated > ago(7d) | where OperationNameValue has_any ( "AUTOMATIONACCOUNTS/SCHEDULES/WRITE", "AUTOMATIONACCOUNTS/JOBSCHEDULES/WRITE") | where ActivityStatusValue in ("Success","Succeeded","Accepted") | project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceGroup, _ResourceId | order by TimeGenerated desc
DETECTS: same schedule / job-schedule writes in Splunk
SPL — Splunk
index=azure sourcetype="azure:activity" (operationName="*AUTOMATIONACCOUNTS/SCHEDULES/WRITE" OR operationName="*AUTOMATIONACCOUNTS/JOBSCHEDULES/WRITE") (status=Success OR status=Succeeded OR status=Accepted) | table _time caller callerIpAddress operationName resourceGroupName resourceId | sort -_time
I5
Managed-Identity / Run As Privilege Grant
T1098.003
WHY CHECK

The power of runbook abuse scales with the identity behind it. An attacker either grants the Automation account's managed identity a high RBAC role (so its runbooks can do anything) or grants an Entra directory role / app-role to the underlying service principal. A roleAssignments/write naming the Automation MI object ID, or an AuditLogs role-add to a service principal, is the privilege-escalation event.

📍 Portal Navigation — RBAC & Entra Roles
portal.azure.com› Subscriptions› Access control (IAM)› Role assignments
  • 1Run both KQL queries below: the AzureActivity query catches Azure RBAC grants; the AuditLogs query catches Entra directory / app-role grants to a service principal.
  • 2Get the Automation account's MI object ID: Automation Accounts → [account] → Identity. Match it against the principal in any roleAssignments/write.
  • 3In Subscriptions → Access control (IAM) → Role assignments, filter by the MI and confirm the granted role and scope. Owner / Contributor / User Access Administrator at subscription scope = CRITICAL.
  • 4Note the initiating principal — if a runbook job (I2) performed the grant, the automation is escalating itself; if a user did it, that user account may be compromised (pivot SOP-04).
OperationMeaningSeverity
MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITEAzure RBAC role granted (target = MI object ID)CRITICAL
Add app role assignment to service principalEntra app-role (e.g. Graph permission) granted to SPCRITICAL
Add member to roleEntra directory role (e.g. Global Admin) grantedCRITICAL
DETECTS: Azure RBAC role assignments — filter results to the Automation MI object ID during triage
KQL — Azure RBAC grant (AzureActivity)
AzureActivity | where TimeGenerated > ago(24h) | where OperationNameValue =~ "MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE" | where ActivityStatusValue in ("Success","Succeeded","Accepted") | project TimeGenerated, Caller, CallerIpAddress, ResourceGroup, _ResourceId, Properties | order by TimeGenerated desc
DETECTS: Entra directory / app-role grants to a service principal (managed identity or Run As SP)
KQL — Entra role grant to SP (AuditLogs)
AuditLogs | where TimeGenerated > ago(24h) | where OperationName in ("Add member to role","Add app role assignment to service principal","Add eligible member to role") | extend TargetName = tostring(TargetResources[0].displayName), TargetType = tostring(TargetResources[0].type) | where TargetType =~ "ServicePrincipal" | project TimeGenerated, Initiator = tostring(InitiatedBy.user.userPrincipalName), OperationName, TargetName | order by TimeGenerated desc
DETECTS: same RBAC and directory-role grants in Splunk
SPL — Splunk
index=azure sourcetype="azure:activity" operationName="MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE" (status=Success OR status=Succeeded OR status=Accepted) | table _time caller callerIpAddress resourceId properties | sort -_time ``` and for Entra role grants: index=azure sourcetype="azure:aad:audit" (operationName="Add app role assignment to service principal" OR operationName="Add member to role") | table _time initiatedBy.user.userPrincipalName operationName targetResources{}.displayName | sort -_time

A role grant that is itself performed by an Automation runbook job is the highest-confidence signal in this SOP — the automation is escalating its own identity with no human in the loop. Treat as active compromise and proceed straight to Containment C2/C4.

I6
Logic App Workflow Abuse
T1648 / T1546
WHY CHECK

Logic Apps are the low-code cousin of runbooks: a workflow with a trigger (often an HTTP-request trigger reachable via a SAS-signed callback URL) and actions that can run inline code or call connectors to Key Vault, Storage, or Exchange Online — all under the workflow's managed identity. An attacker creates or edits a workflow to exfiltrate secrets or mail, using the HTTP trigger as an unauthenticated-style persistence channel.

📍 Portal Navigation — Logic Apps
portal.azure.com› Logic apps› [workflow]› Run history / Designer
  • 1Run the AzureActivity KQL for workflow writes and the AzureDiagnostics WorkflowRuntime KQL for trigger/action runs.
  • 2Open Logic apps → [workflow] → Logic app designer and inspect the trigger type and the actions — flag HTTP-request triggers, Key Vault / Office 365 / Storage connectors, and inline "Execute code" actions.
  • 3Check Run history for triggers fired from unexpected client IPs, and the workflow's Identity blade for the MI and its role assignments (pivot to I5).
  • 4A newly created or modified workflow with an HTTP trigger plus a sensitive connector, called from an external IP, is a confirmed abuse artifact.
DETECTS: creation/modification of Logic App workflows and their manual/HTTP trigger runs
KQL — Workflow write (AzureActivity)
AzureActivity | where TimeGenerated > ago(24h) | where OperationNameValue in~ ( "MICROSOFT.LOGIC/WORKFLOWS/WRITE", "MICROSOFT.LOGIC/WORKFLOWS/TRIGGERS/RUN/ACTION") | where ActivityStatusValue in ("Success","Succeeded","Accepted") | project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceGroup, _ResourceId | order by TimeGenerated desc
KQL — Workflow runtime (AzureDiagnostics)
AzureDiagnostics | where TimeGenerated > ago(24h) | where ResourceProvider == "MICROSOFT.LOGIC" | where Category == "WorkflowRuntime" | where OperationName has_any ("workflowTriggerStarted","workflowActionStarted") | project TimeGenerated, resource_workflowName_s, status_s, OperationName, clientIP_s | order by TimeGenerated desc
DETECTS: same Logic App workflow writes and runtime events in Splunk
SPL — Splunk
index=azure sourcetype="azure:activity" (operationName="MICROSOFT.LOGIC/WORKFLOWS/WRITE" OR operationName="MICROSOFT.LOGIC/WORKFLOWS/TRIGGERS/RUN/ACTION") | table _time caller callerIpAddress operationName resourceId | sort -_time ``` and workflow runtime: index=azure sourcetype="azure:diagnostic" ResourceProvider="MICROSOFT.LOGIC" Category=WorkflowRuntime (OperationName="*workflowTriggerStarted*" OR OperationName="*workflowActionStarted*") | table _time resource_workflowName status OperationName clientIP | sort -_time
I7
IOC Extraction & FP / TP Decision Gate
VERDICT

Pull the following before you make the call — they drive both containment and any downstream hunt:

  • 1Identities: the Caller UPN/appId that wrote the runbook/workflow; the Automation account MI object ID; any principal that received a role grant.
  • 2Resources: Automation account & runbook names, webhook/schedule names, Logic App workflow name, target subscription/resource group.
  • 3Network: CallerIpAddress / clientIP of the writes and trigger runs; resolve ASN and geo (pivot SOP-36 for anonymiser).
  • 4Payload: the runbook body and any URLs, IPs, or base64 blobs it contains; job IDs and their JobStreams output.
  • 5Timeline: first write → publish → job start → role grant → trigger creation, as an ordered sequence.
True-Positive SignalsFalse-Positive Signals
Write/publish + job start + role grant in one short burst by a human callerChange ticket / release pipeline run naming this account and window
JobStreams output reading Key Vault secrets or calling New-AzRoleAssignmentKnown deployment SP as Caller from a corporate/CI egress IP
Webhook created on a sensitive runbook / far-future expiryWebhook/schedule matching a documented integration owned by a named team
CallerIpAddress on a hosting/VPN/Tor ASN or new geographyRunbook body unchanged; only a benign parameter/tag edit
Role grant elevating the Automation MI to Owner/Contributor/UAARole grant matches least-privilege design approved in the account's runbook README

Decision rule: any single true-positive signal with no corroborating change record = confirmed, proceed to Containment. Close as false positive only when a change ticket or pipeline run names this account, this operation, and this time window, and the runbook body is confirmed benign. "An engineer probably did it" is a hypothesis, not a verdict.

🚫

03 — CONTAINMENT

STOP IT
C1
Verdict & Escalation Decision
DECISION GATE
▶ Based on Identification Findings
CONFIRMED Malicious runbook/workflow ran, webhook/schedule created, or MI role grant with no change ticket — execute C2–C4 immediately, escalate to L2/IR
UNCERTAIN Runbook write by a human with no owner reply yet, no job output, no role grant — disable the runbook/webhook precautionarily, complete I2/I5, hold
FALSE POS. Deployment pipeline SP from corporate IP with a matching change record; benign parameter edit — document, close, tune the analytic

Do not delete the runbook before exporting its content and the job output — that is your primary evidence of what executed. Disable/suspend first, export, then remediate.

C2
Stop Execution & Kill Persistence Triggers
IMMEDIATE
📍 Portal Navigation — Automation Account
portal.azure.com› Automation Accounts› [account]› Jobs / Webhooks / Schedules / Runbooks
  • 1Stop any running job: Jobs → select the job → Stop. This halts in-flight execution before you touch anything else.
  • 2Delete rogue webhooks: Webhooks → select → Delete. This invalidates the URL instantly (I3).
  • 3Remove rogue schedules / links: Schedules → disable or delete the schedule; unlink it from the runbook (I4).
  • 4Suspend the runbook: Runbooks → the suspect runbook → Edit and revert to a known-good published version, or set the runbook to draft so it cannot be started. Export the malicious version first (Export-AzAutomationRunbook).
  • 5If Logic App abuse (I6): Logic apps → [workflow] → Disable, and regenerate the HTTP-trigger callback URL / access-key so the old signed URL stops working.
Azure CLI / PowerShell — stop & contain
# Stop a running job Stop-AzAutomationJob -ResourceGroupName <rg> -AutomationAccountName <acct> -Id <jobId> # Remove a rogue webhook (invalidates the URL) Remove-AzAutomationWebhook -ResourceGroupName <rg> -AutomationAccountName <acct> -Name <webhookName> # Unlink / remove a rogue schedule Remove-AzAutomationSchedule -ResourceGroupName <rg> -AutomationAccountName <acct> -Name <scheduleName> # Disable a Logic App workflow az logic workflow update --resource-group <rg> --name <workflow> --state Disabled
C3
Contain the Workload Identity & Rotate Secrets
IDENTITY
📍 Portal Navigation — Enterprise Applications & Key Vault
entra.microsoft.com› Enterprise applications› [Automation SP]› Properties › Enabled = No
  • 1If the identity is compromised and non-critical, disable the service principal: Enterprise applications → the Automation/Logic App SP → Properties → Enabled for users to sign in = No.
  • 2Revoke active tokens for the SP so already-issued access tokens stop working: Revoke-MgServicePrincipalSignInSession (Graph PowerShell) against the SP object ID.
  • 3If a legacy Run As account is in use, its certificate may be exposed — regenerate/remove the Run As certificate in the Automation account and migrate to a managed identity.
  • 4Rotate every secret the runbook could read: any Key Vault secret, storage key, or connection string the JobStreams output touched must be treated as compromised — rotate now (pivot SOP-44 for Key Vault).

Disabling the runbook and rotating credentials does NOT revoke already-minted managed-identity access tokens — they remain valid until expiry (typically up to ~24 hours, commonly ~60–90 minutes for the token itself). You must revoke the SP sessions AND block at the resource side (Key Vault access policy / RBAC, Storage key) and confirm activity has stopped before declaring containment.

C4
Reverse Privilege Escalation & Block Caller
RBAC
📍 Portal Navigation — Access Control (IAM)
portal.azure.com› Subscription / Resource› Access control (IAM)› Role assignments
  • 1Remove any attacker-added role assignment identified in I5 — match the exact principal, role, and scope; do not strip legitimate assignments.
  • 2Remove attacker-added Entra directory roles / app-role assignments from the service principal.
  • 3If the write caller was a human user, contain that account: revoke sessions and reset credentials (pivot SOP-04) — the runbook change was likely made with stolen creds.
  • 4Block the malicious CallerIpAddress at your egress / Conditional Access named locations, and add any C2 domain/IP from the runbook body to Defender/firewall indicators (pivot SOP-34).
  • 5Sweep all other Automation accounts and Logic Apps in the tenant for writes from the same caller or IP in the same window — assume the actor touched more than one.
🗑

04 — ERADICATION

CLEAN UP
E1
Full Cleanup, Vector Closure & Verification
ERADICATION
  • 1Remove all attacker artifacts: delete the malicious runbook (after evidence export), all rogue webhooks and schedules, and any attacker-created Logic App workflow. Enumerate every runbook, webhook, and schedule in the account — attackers plant more than one.
  • 2Enumerate all credentials on the identity: check the Automation/Logic App SP for attacker-added secrets, certificates, and federated identity credentials (an FIC lets an external token authenticate with no stored secret — a stealthy persistence trick). Remove any you did not create.
  • 3Reconstruct data-at-risk: from JobStreams and resource-side logs (Key Vault, Storage, Exchange) determine which secrets and data the runbook/workflow actually accessed, and rotate everything in reach.
  • 4Close the entry point: right-size the Automation account MI to least privilege (remove standing Owner/Contributor at subscription scope); restrict who holds Automation Contributor / Logic App Contributor; require change-controlled deployment for runbook publishes.
  • 5Turn on the missing telemetry: enable diagnostic settings on the Automation account (JobLogs + JobStreams) and Logic Apps (WorkflowRuntime) to Log Analytics so this is never invisible again.
  • 6Verify clean: re-run I1, I3, I4, and I5 expecting 0 hits; confirm no webhook/schedule remains and the identity holds only approved roles.
Eradication Complete When
  • Malicious runbook, webhooks, schedules, and rogue Logic App workflows are deleted (evidence exported first)
  • All attacker-added SP secrets, certificates, and federated identity credentials removed
  • Attacker-added RBAC and Entra role assignments reversed; MI at least privilege
  • Every Key Vault secret / storage key / connection string in reach of the runbook rotated
  • Compromised caller account(s) reset and sessions revoked; malicious IP blocked
  • Diagnostic logging (JobLogs/JobStreams, WorkflowRuntime) enabled to the SIEM
  • Re-run of I1/I3/I4/I5 returns 0 hits; tenant-wide sweep for the same caller/IP is clean
📢

05 — ESCALATION

TIERS
ES1
Escalation Matrix & Notification
ESCALATION
TierTrigger ConditionWho to NotifyAction
L1 → L2Runbook/workflow write cannot be confirmed as a change within 30 min, or the identity holds a privileged role, or >1 Automation account touchedSOC L2Hand off with the I7 IOC pack and timeline
L2 → IRConfirmed malicious execution, MI privilege escalation, webhook/schedule persistence, or Key Vault secret access in JobStreamsIncident Response TeamOpen incident, execute C2–C4, begin tenant-wide hunt
IR → CISOSubscription-wide compromise, Owner/UAA obtained via MI, or confirmed exfiltration of secrets/dataCISO + Cloud Platform leadInvoke major-incident process; consider credential rollover at scale
CISO → Exec/LegalRegulated data exfiltrated (GDPR/PCI/HIPAA), production customer-facing workload affected, or multi-tenant/CSP identity involvedExec, Legal, DPOStart breach-notification clock (e.g. GDPR 72h); engage comms
ExternalNation-state TTPs, need for cloud forensics, or Microsoft-side investigation requiredMSSP / Microsoft DART / law enforcementPreserve evidence; engage per contract

Bring to every escalation:

  • 1Incident / alert ID, subscription and Automation account / Logic App names
  • 2Caller identity (UPN/appId) + CallerIpAddress/ASN, and the Automation MI object ID
  • 3Timeline: write → publish → job start → role grant → trigger creation
  • 4Runbook/workflow body, JobStreams excerpts, and extracted IOCs
  • 5Containment already taken and current confidence (TP confirmed / suspected / unverified)
MITRE ATT&CKTechniqueWhere seen
T1648Serverless ExecutionRunbook job (I1/I2), Logic App workflow run (I6)
T1546Event Triggered ExecutionWebhook (I3) & schedule (I4) persistence
T1098.003Account Manipulation: Additional Cloud RolesMI / SP role grant (I5)
T1078.004Valid Accounts: Cloud AccountsManaged-identity re-use for non-interactive execution
T1552.006Unsecured Credentials: Cloud Instance Metadata / secretsKey Vault / storage-key reads in JobStreams (I2)

If the compromised identity belongs to a multi-tenant or CSP/partner automation, the blast radius may extend beyond your tenant — escalate straight to CISO and treat as a potential supply-chain event regardless of the observed action count.

ES2
Sources & References
REFERENCE
  • 1MITRE ATT&CK — T1648 Serverless Execution; T1546 Event Triggered Execution; T1098.003 Additional Cloud Roles
  • 2Microsoft Learn — Azure Automation: runbooks, webhooks, schedules, managed identities, and diagnostic settings (JobLogs / JobStreams)
  • 3Microsoft Learn — Azure Logic Apps: HTTP-request triggers, managed identity, and workflow diagnostic logs (WorkflowRuntime)
  • 4Microsoft Sentinel — AzureActivity, AzureDiagnostics, and AuditLogs table schemas (Advanced Hunting / Log Analytics)
  • 5Related CyberHawk SOPs — SOP-44 (Key Vault Secret Access), SOP-48 (Azure Subscription Management-Plane Abuse), SOP-110 (Service Principal / Workload Identity Abuse), SOP-04 (Account Compromise)

Stay Threat-Ready

Follow CyberHawk Threat Intel for daily SOC analyst playbooks, detection engineering guides, and threat intelligence.

📺 YouTube 🎤 TikTok 🐦 X / Twitter 📡 Telegram
All SOPs Blog Web App (Free)
They can't exploit you if you are the Exploit.