Repository navigation
Log in to Azure Container Registry with Entra identities (workload identity, managed identity, OIDC) - #6
Merged
Conversation
Support passwordless pushes to Azure Container Registry, including self-hosted Azure DevOps agents and GitHub runners: - Azure DevOps Docker Registry (ACR) and Azure Resource Manager service connections with workload identity federation (job OIDC token), managed identity or service principal - GitHub OIDC (AZURE_CLIENT_ID / AZURE_TENANT_ID, id-token: write) - AKS workload identity of agent/runner pods - managed identity of agent VMs / VM scale sets (IMDS) Tokens are exchanged for an ACR refresh token like az acr login does, without the Azure CLI. HTTP calls use curl with the request on stdin so proxies are honoured and secrets stay out of the process list. An existing docker login is kept before trying agent identities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HpAsQazVvi679PqLz7o1C1
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds passwordless pushes to Azure Container Registry (
*.azurecr.io), including from self-hosted Azure DevOps agents and GitHub runners. The login works likeaz acr login(Entra access token →https://<acr>/oauth2/exchange→ ACR refresh token →docker login) without needing the Azure CLI.When no username/password is configured, the first available identity is used:
azureSubscriptioninput) using workload identity federation, managed identity or a service principal. For federation, the job OIDC token is requested fromSystem.OidcRequestUriwithSystem.AccessToken.azure-client-id/azure-tenant-idor theAZURE_CLIENT_ID/AZURE_TENANT_IDvariables, plusid-token: write.az acr loginin a previous step, so it isn't overwritten.AZURE_FEDERATED_TOKEN_FILE).AZURE_CLIENT_IDselects a user-assigned identity.On a self-hosted pool with a managed identity or workload identity,
CONTAINER_REGISTRY=myacr.azurecr.ioin the agent's or runner's.envfile is the only configuration needed.Details
src/core/http.tsis a small curl-based client. The whole request (URL, headers, body) goes to curl on stdin, so tokens never appear in the process list, and proxy and CA settings of corporate self-hosted agents are honoured. IMDS is always called without a proxy.id-token: write. It exports only the org variables and secrets that are actually set, so variables the runner already provides (runner.env, AKS workload identity) aren't overwritten with empty values.e2e-acr-oidcdoes a real ACR push via GitHub OIDC. It runs only when the repository variablesE2E_ACR,AZURE_CLIENT_IDandAZURE_TENANT_IDare set.Testing
e2e-acr-oidcjob covers that once its variables are configured.Generated by Claude Code