Your CI Pipeline Is a Non-Human Identity. Here Is How to Retire Its Azure Client Secret
If your GitHub Actions workflow logs in to Azure with a client secret stored in AZURE_CREDENTIALS, that secret is a password for an account that can never do MFA. Microsoft has spent the last few weeks publishing researc
If your GitHub Actions workflow logs in to Azure with a client secret stored in AZURE_CREDENTIALS, that secret is a password for an account that can never do MFA. Microsoft has spent the last few weeks publishing research on what happens when those secrets leak, and the short version is that it now happens at machine speed.
This post covers what Microsoft reported, then walks through replacing the secret with workload identity federation (OIDC), finding the secrets you still have, and the controls that apply to the service principals you cannot change yet. Every command and limit below comes from Microsoft Learn or Microsoft's own security posts.
TL;DR
- Service principals, managed identities, CI/CD runners and AI agents are "non-human identities". They cannot complete an MFA prompt, so a stolen credential is all an attacker needs.
- Microsoft Threat Intelligence reported an agentic AI framework that scans public GitHub repos for secrets. In one case an agent went from scanning GitHub to exfiltrating data from Azure Key Vault in about five minutes.
- For GitHub Actions to Azure, you can drop the secret entirely: add a federated identity credential to the app registration and use
azure/login@v2withid-token: write. - A leaked secret stays valid until you revoke or rotate it. Deleting the commit does not fix anything.
What Microsoft actually reported
Three posts are worth reading together.
On 25 September 2026 Microsoft Security Research described Storm-3168 (the actor Sysdig calls JADEPUFFER). Microsoft observed two compromised service principals in one tenant. One spent about 15 and a half hours enumerating subscriptions, resource groups and VMs. The other later ran bulk destructive operations against Storage Accounts, SQL databases, Key Vaults, Function Apps, VMs, App Services and recovery protection locks, and collected credentials.
On 5 November 2026 Microsoft Threat Intelligence published research on threat actors using an agentic offensive framework, which Microsoft calls ARTEX, to search public GitHub repositories for exposed secrets, including application credentials and AI inference API keys. The agents then analyze what they find and run the follow-on attack with less hands-on-keyboard work. The post also makes the point that matters most for developers: publicly exposed credentials remain usable until they are revoked or rotated, and removing the original disclosure does not remediate the exposure.
On 8 November 2026 a Microsoft Tech Community post, "Securing the Non-Human Identity Attack Surface", pulled this into a three-layer model: Entra Workload ID to control who gets a token, Defender for Resource Manager to watch what the identity does after it signs in, and Agent 365 to govern AI agents as their own identities.
That last post is mostly aimed at security teams. The part developers own is simpler: stop creating long-lived secrets in the first place.
Step 1: Replace the GitHub Actions secret with OIDC
With workload identity federation, GitHub issues a short-lived OIDC token for each workflow run, and Microsoft Entra ID exchanges it for an Azure access token if the token's issuer, subject and audience match a trust you configured. There is no secret to store or leak.
You need an app registration (or a user-assigned managed identity, which also supports federated credentials) with a service principal and a role assignment scoped as tightly as you can manage. Then add the federated credential.
Create credential.json:
{
"name": "github-main",
"issuer": "https://token.actions.githubusercontent.com",
"subject": "repo:my-org/my-repo:ref:refs/heads/main",
"description": "Deploys from main",
"audiences": ["api://AzureADTokenExchange"]
}
Then attach it to the app. --id accepts the app's object ID, application (client) ID or identifier URI:
az ad app federated-credential create \
--id <APP_CLIENT_ID> \
--parameters credential.json
The subject is the important part, because it decides which workflow runs can get a token:
- Jobs tied to a GitHub environment:
repo:<org>/<repo>:environment:<name> - Jobs not tied to an environment:
repo:<org>/<repo>:ref:<ref path>, for examplerefs/heads/mainorrefs/tags/v1.0.0
Using an environment is the better choice for production deploys, because GitHub can require a reviewer before the job runs. Keep in mind that one app or user-assigned managed identity can hold a maximum of 20 federated identity credentials, so plan your subjects instead of adding one per branch.
Step 2: Update the workflow
Store AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_SUBSCRIPTION_ID as GitHub secrets. None of them is a credential on its own, but Microsoft's sample keeps them out of the YAML, and for public repos Microsoft recommends environment secrets over repository secrets.
name: deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write # required to request the OIDC token
contents: read
steps:
- uses: actions/checkout@v4
- name: Azure login (OIDC, no secret)
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Check who we are
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
The azure/login action's audience input defaults to api://AzureADTokenExchange for the public cloud, so you only set it for sovereign clouds. Add enable-AzPSSession: true if later steps use Azure PowerShell.
Once a run succeeds, delete the old AZURE_CREDENTIALS secret from GitHub and delete the password credential on the app. Removing it from GitHub alone leaves a working secret in Entra ID.
Step 3: Find the secrets you still have
You cannot read a secret's value back, but you can list its metadata, including when it expires:
az ad app credential list --id <APP_CLIENT_ID> \
--query "[].{name:displayName, keyId:keyId, expires:endDateTime}" -o table
And remove one once nothing depends on it:
az ad app credential delete --id <APP_CLIENT_ID> --key-id <KEY_ID>
A secret with a two year expiry that nobody remembers creating is exactly what these campaigns look for. If a secret ever appeared in a public repo, an issue, a gist or a build log, treat it as compromised and rotate it now, even if the post was edited.
On the prevention side, GitHub secret scanning and push protection can block supported secrets before they are pushed, and Microsoft's 5 November post recommends turning them on for both GitHub and Azure DevOps (through GitHub Advanced Security for Azure DevOps).
Step 4: Lock down what cannot move yet
Some service principals will keep a secret for a while: third-party tools, old scripts, systems outside GitHub. For those, Entra has Conditional Access for workload identities. It can block a service principal from outside known public IP ranges, or when Entra ID Protection flags it as risky.
Read the fine print on Microsoft Learn before you plan around it:
- Creating or changing these policies needs Workload Identities Premium licenses.
- It applies to single tenant service principals registered in your tenant. Multitenant and third-party SaaS apps are not covered.
- Managed identities are not covered. Microsoft suggests access reviews for those instead.
- Adding a service principal to a group in a policy does not work. It must be assigned to the policy directly as a workload identity.
The rest is ordinary hygiene that is easy to skip: give the pipeline a role on one resource group instead of Contributor on the subscription, give every service principal an owner, and delete app registrations nobody uses.
Where this leaves us
Static secrets for CI were always a risk. What changed in 2026 is the speed: Microsoft documented agents going from a public repo to Key Vault data in minutes, and destructive runs driven by compromised service principals. Federation is not new, but it is now the obvious default for anything that deploys to Azure from GitHub.
Question for you: how many long-lived client secrets are still sitting in your CI setup, and what is stopping you from moving them to OIDC? Is it tooling that does not support federation, or just nobody owning the cleanup?
I cover the wider Entra Workload ID, Defender and Agent 365 picture for admins on Windows Mode.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.