PIVTR-D
RAzure playbook · Pipelines and supply chain

DevOps pipeline or federated credential abused

An attacker with write access to a repository or pipeline changes the YAML so a run uses an Azure service connection, prints or sends out secret variables, or deploys their own code. With rights in Microsoft Entra ID, the attacker adds a federated credential that trusts their own GitHub repository or branch, then signs in from their workflow with no secret at all. Disable the service connection and remove federated credentials you did not create first, then rotate every secret the runs could read.

Look here

LogSearch for
Azure DevOps audit logService connection use and changes, variable group and agent changes, pipeline edits and new tokens. Needs the Log Audit Events organization policy, and events are kept 90 days. Look for Library.ServiceConnectionExecuted, Library.ServiceConnectionModified, Library.ServiceConnectionShared, Library.VariableGroupModified, Library.AgentAdded, Library.AgentPoolCreated, Pipelines.PipelineModified, Pipelines.ResourceAuthorizedForPipeline, Pipelines.VariablesSetAtRuntime, Policy.PolicyConfigRemoved, Token.PatCreateEvent and Library.ServiceConnectionPropertyChanged
AzureDevOpsAuditingThe same events in the workspace, after you add an Azure Monitor Logs audit stream. New events arrive within about 30 minutes
Pipeline runsRuns whose source branch, requester or reason differ from normal runs. Read the logs of runs in the window: az pipelines runs list --org https://dev.azure.com/<org> --project <project> --query-order FinishTimeDesc --top 100
AuditLogs (Entra)Credentials and owners added to the pipeline's app: Update application with a federated credential in the modified properties, Add service principal credentials and Add owner to application
Federated credentials nowEach trust's issuer and subject, for example repo:<org>/<repo>:environment:<name>: az ad app federated-credential list --id <app-id>
AADServicePrincipalSignInLogsSign-ins by the pipeline's app from new addresses or to new resources: AADServicePrincipalSignInLogs | where AppId == "<app-id>" | summarize count() by IPAddress, ResourceDisplayName, ResultType
AzureActivityWhat the pipeline identity changed in Azure: AzureActivity | where Caller == "<sp-object-id>" | summarize count() by OperationNameValue, CallerIpAddress
AzureActivity, managed identitiesFederated credentials added to user-assigned managed identities, logged as: Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write

Contain

#Item
1Export the Azure DevOps audit log for the window, and save the YAML, run logs and service connection settings as evidence
2Disable the service connection from its More options menu. Pipelines that use it then fail until you enable it again
3Stop every pipeline in the project from using the connection without authorization: az devops service-endpoint update --id <endpoint-id> --enable-for-all false --org https://dev.azure.com/<org> --project <project>
4Add an approval check on the service connection
5Record the pipeline identity's Azure roles: az role assignment list --assignee <app-id> --all
6Remove those role assignments: az role assignment delete --ids <assignment-id>
7Delete federated credentials you did not create on the app destructive: az ad app federated-credential delete --id <app-id> --federated-credential-id <name>
8Delete federated credentials you did not create on a managed identity destructive: az identity federated-credential delete --name <fic> --identity-name <identity> --resource-group <rg>
9Rotate every secret the runs could read: secret variables, variable groups, secure files and the Key Vault secrets linked to variable groups. Follow the Key Vault playbook for the vault
10List the self-hosted agents in the pool and their last jobs: az pipelines agent list --pool-id <id> --org https://dev.azure.com/<org> --include-last-completed-request true
11Take unknown agents offline and remove them from the pool destructive

Eradicate and recover

#Item
1Revert YAML and branch policy changes, and require reviewed pull requests on branches that can reach production service connections
2Rebuild self-hosted agent machines from a clean image before they rejoin the pool
3Move GitHub trusts to environment subjects protected by required reviewers, and to GitHub's immutable subject format. GitHub applies that format automatically to repositories created, renamed or transferred since July 15, 2026: repo:<owner>@<owner-id>/<repo>@<repo-id>:...
4Convert workload identity federation connections that use the Azure DevOps issuer https://vstoken.dev.azure.com to the Microsoft Entra issuer before the Azure DevOps issuer retires on July 1, 2027
5Replace secret-based service connections with workload identity federation, and give each connection roles on one resource group
6Turn on the audit stream to the workspace, and check artifacts or images the attacker's runs produced with the ACR image tampering playbook
Watch out
  • Azure DevOps records no sign-in events. Read Microsoft Entra sign-in logs for who used the organization.
  • A flexible federated credential matches subjects with wildcards such as claims['sub'] matches 'repo:contoso/contoso-repo:ref:refs/heads/*'. Read the expression, because one credential covers every matching branch.
  • Federated credential changes take several minutes to reach the directory cache in each region, and tokens already issued stay valid until they expire. Remove the role assignments as well.

Microsoft Learn: Azure DevOps auditing, audit events list, audit streaming, service connections, connect to Azure with an Azure Resource Manager service connection, Entra workload identity federation trust for GitHub, flexible federated identity credentials, migrate GitHub Actions credentials to immutable subjects, workload identity federation considerations, Entra audit activity reference, Azure CLI reference for az devops, az pipelines, az ad app federated-credential and az identity. Checked October 2026.

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.