How the attack works
Azure Container Registry (ACR) Tasks build and run containers in Azure on behalf of a registry. A quick task builds or runs once on demand. A stored task is a definition in the registry that starts by hand, on a source code commit, on a base image update or on a timer. A multi-step task executes one or more containers, each step using the container as its execution environment, so a task is a general way to run code on compute that Microsoft operates, started through Azure Resource Manager. Microsoft documents that a task can be given a system-assigned or user-assigned managed identity, and that when the task runs it uses the identity in any step that needs access to another resource. A build task pushes the built image to its registry by default, and Microsoft's description of the Container Registry Tasks Contributor role says that task permissions can be used for full data-plane access to the registry, including reading, writing and deleting container images, and to run customer-authored build directives and scripts.
An attacker who holds task permissions on a registry gets three things from this. The task steps are code execution that needs no virtual machine and no access to a cluster. The task's managed identity acts for the attacker on whatever the identity can reach, such as another registry or a key vault. And the task can push images into the registry, so that workloads that pull from it later run the attacker's image. All of this happens through control-plane operations that the Azure Activity log records with their caller: writing a task (Microsoft.ContainerRegistry/registries/tasks/write), writing a task run and scheduling a run (Microsoft.ContainerRegistry/registries/scheduleRun/action). The log does not record what the steps of a run did. That is in the run's own log output, which the registry stores. No public incident report was found that describes this at the level of these operations, so the page rests on what Microsoft documents the feature can do.
What an attacker needs
- A role with the task operations on the registry: Container Registry Tasks Contributor, which Microsoft describes as managing task definitions and task runs, quick builds and quick runs, or Contributor or Owner.
- To attach a user-assigned identity to a task, Microsoft notes that the Managed Identity Operator role is needed as well.
- For more than execution: a task identity with rights on other resources, or workloads that pull images from the registry.
Impact
Code execution on Azure compute under the registry's task service, with the rights of the task's managed identity on other Azure resources. Images in the registry can be replaced, which turns one registry permission into code execution in every workload that deploys those images. A task with a timer or a commit trigger keeps running after the attacker's session ends.
Detection rules
Container Registry Run Scheduled
Detects a successful request to schedule a run against an Azure container registry (Microsoft.ContainerRegistry/registries/scheduleRun/action). The operation adds a new run to the run queue of the registry, which starts a build or a set of container steps on Azure compute on demand. A quick build is scheduled this way and needs no stored task. Developers and pipelines that build images in the registry produce this event all the time, so the rule is a starting point for a baseline of expected callers for each registry and not an alert on its own. It carries more weight on a registry that is not used for builds. The event does not say what the run executed.
title: Container Registry Run Scheduled
id: e9c7a212-3ad4-4e21-8d7e-a4e2bfed9c40
status: experimental
description: >-
Detects a successful request to schedule a run against an Azure container
registry (Microsoft.ContainerRegistry/registries/scheduleRun/action). The
operation adds a new run to the run queue of the registry, which starts a
build or a set of container steps on Azure compute on demand. A quick build
is scheduled this way and needs no stored task. Developers and pipelines that build images in the registry produce this
event all the time, so the rule is a starting point for a baseline of
expected callers for each registry and not an alert on its own. It carries
more weight on a registry that is not used for builds. The event does not
say what the run executed.
references:
- https://attack.mitre.org/techniques/T1648/
- https://learn.microsoft.com/en-us/azure/container-registry/container-registry-tasks-overview
- https://learn.microsoft.com/en-us/azure/container-registry/container-registry-roles
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/containers
author: Forestall
date: 2026-11-18
tags:
- attack.execution
- attack.t1648
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue: MICROSOFT.CONTAINERREGISTRY/REGISTRIES/SCHEDULERUN/ACTION
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Developers and build pipelines that build or run images with the registry's quick build and quick run. Exclude their identities in a filter_ selection by Caller, or limit the rule to registries that are not meant to build.
level: low
False positives
- Developers and build pipelines that build or run images with the registry's quick build and quick run. Exclude their identities in a filter_ selection by Caller, or limit the rule to registries that are not meant to build.
Container Registry Task or Task Run Created or Changed
Detects a successful create or update of an Azure Container Registry task (Microsoft.ContainerRegistry/registries/tasks/write) or of a task run resource (registries/taskruns/write). A task defines containers and build steps that the registry runs on Azure compute, by hand, on a commit, on a base image update or on a timer, and it can carry a managed identity that its steps use. Writing a task therefore decides what code will run for the registry and with which identity. The event does not say what the task definition contains, so read the task after the rule fires.
title: Container Registry Task or Task Run Created or Changed
id: 8a81d35c-a6c0-4bae-b3bc-163809d5d67f
status: experimental
description: >-
Detects a successful create or update of an Azure Container Registry task
(Microsoft.ContainerRegistry/registries/tasks/write) or of a task run
resource (registries/taskruns/write). A task defines containers and build
steps that the registry runs on Azure compute, by hand, on a commit, on a
base image update or on a timer, and it can carry a managed identity that
its steps use. Writing a task therefore decides what code will run for the
registry and with which identity. The event does not say what the task
definition contains, so read the task after the rule fires.
references:
- https://attack.mitre.org/techniques/T1648/
- https://learn.microsoft.com/en-us/azure/container-registry/container-registry-tasks-overview
- https://learn.microsoft.com/en-us/azure/container-registry/container-registry-tasks-authentication-managed-identity
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/containers
author: Forestall
date: 2026-11-18
tags:
- attack.execution
- attack.t1648
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue:
- MICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKS/WRITE
- MICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKRUNS/WRITE
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Build engineers and infrastructure-as-code pipelines that create and update build tasks. Exclude their identities in a filter_ selection by Caller once confirmed, per registry where possible.
- Features that are built on tasks, such as scheduled purge of old images, which create a task when they are configured.
level: medium
False positives
- Build engineers and infrastructure-as-code pipelines that create and update build tasks. Exclude their identities in a filter_ selection by Caller once confirmed, per registry where possible.
- Features that are built on tasks, such as scheduled purge of old images, which create a task when they are configured.
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.
Task created, run and deleted by the same caller within a short time
A build task is created once and then runs for months. A task that is created, started and removed again within the hour was only there to run its steps once, and deleting it hides the definition that would explain what ran.
- In the Azure Activity log, find
MICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKS/WRITEwith status Success. Keep theCallerand the resource ID of the task. - Within 60 minutes, find
MICROSOFT.CONTAINERREGISTRY/REGISTRIES/SCHEDULERUN/ACTIONorMICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKRUNS/WRITEby the sameCalleron the same registry. - Within the same window, find
MICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKS/DELETEby the sameCallerfor the same task.
EventsMICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKS/WRITEMICROSOFT.CONTAINERREGISTRY/REGISTRIES/SCHEDULERUN/ACTIONMICROSOFT.CONTAINERREGISTRY/REGISTRIES/TASKS/DELETE
LimitsDevelopers who try out a task definition and clean up afterwards do the same, as do pipelines that create temporary tasks. The 60 minutes are a starting point. A quick run needs no stored task at all and shows only the scheduling event, so this pattern does not cover it.
Triage
- Identify the Caller, the caller's IP address and the registry, and whether this identity creates tasks or schedules runs on this registry routinely. Build pipelines do.
- Open the task definition and read its steps, its source location, its triggers and the identity attached to it.
- Check what the task identity can access, and review its activity after the run.
- Read the log output of the runs that followed, and check which images in the registry were pushed or changed in the same period.
- Look for the task being deleted soon after a run, and for other task or credential operations on the registry by the same caller.
Response
Once the attack is confirmed:
- Disable or delete the task and cancel runs that are still in progress.
- Contain the caller. Revoke its sessions, rotate its credentials and remove its task permissions on the registry.
- Remove the role assignments of the task's managed identity, and review what the identity did while the task existed.
- Find the images that were pushed during or after the runs, remove or quarantine them, and redeploy affected workloads from images you trust.
- Rotate secrets that the task steps could read, such as secrets passed to the task and credentials of other registries.
Mitigation
- Limit Container Registry Tasks Contributor, Contributor and Owner on registries to the pipeline identities and the few people who maintain build tasks.
- Give task identities only the rights the build needs, such as pull access to one other registry, and do not reuse a privileged user-assigned identity for a task.
- Keep Managed Identity Operator on privileged identities away from the principals that can write tasks.
- Pin production workloads to image digests or signed images, so that an image pushed under an existing tag is not deployed unnoticed.
- Send the Azure Activity log to your SIEM and baseline which identities create tasks and schedule runs on each registry.
Frequently asked questions
Does the Activity log show what a task run executed?
No. The Activity log records the Azure Resource Manager operations, such as writing the task and scheduling a run, with their caller. What the steps of a run did is in the log output of the run, which the registry stores and which can be read in the portal or with the task log commands. Read it during triage.
Why is the rule on scheduled runs only low?
Building an image with the registry's quick build is an everyday developer and pipeline action, and it schedules a run each time. One such event says little. The rule is meant for a baseline of expected callers for each registry, and for registries that are not supposed to build at all, where any run is unexpected.
Why does a managed identity on a task matter?
Microsoft documents that a task uses its managed identity in any step that needs access to another resource. Whoever can write the task decides what those steps do, so the identity's rights become that person's rights for the length of a run. A task with a privileged user-assigned identity is a way to act as that identity without holding its role.
Is there a public incident that used registry tasks this way?
No public incident report was found that describes this at the level of the audit events. The page is based on what Microsoft documents about the feature, which covers running containers on demand, managed identities for tasks and pushing built images to the registry.