fix: resolve ARM token resource from AZURE_AUTHORITY_HOST for sovereign cloud ACR auth#27580
Open
atiasadir wants to merge 1 commit intoargoproj:masterfrom
Open
Conversation
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
926c4fb to
aab6757
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #27580 +/- ##
=======================================
Coverage 63.63% 63.64%
=======================================
Files 417 417
Lines 57079 57090 +11
=======================================
+ Hits 36322 36333 +11
+ Misses 17361 17360 -1
- Partials 3396 3397 +1 ☔ View full report in Codecov by Sentry. |
aab6757 to
d4a4e20
Compare
jagpreetstamber
approved these changes
Apr 29, 2026
…gn cloud ACR auth ArgoCD hardcodes the ARM token scope to the commercial endpoint (https://management.core.windows.net) when exchanging a Workload Identity access token for an ACR refresh token. On sovereign clouds, this causes 401 Unauthorized because the token audience does not match the cloud ARM resource. This change resolves the ARM token resource from AZURE_AUTHORITY_HOST, which is the only cloud-identifying env var injected by the AKS Workload Identity mutating webhook into workload pods. Supported clouds (auto-resolved): - Azure Public (login.microsoftonline.com) -> management.core.windows.net - Azure US Government (login.microsoftonline.us) -> management.core.usgovcloudapi.net - Azure China (login.partner.microsoftonline.cn) -> management.core.chinacloudapi.cn For other cloud environments, set AZURE_ARM_TOKEN_RESOURCE explicitly. Signed-off-by: Adir Atias <adatias@microsoft.com>
d4a4e20 to
a946ce3
Compare
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
When using Azure Workload Identity (
useAzureWorkloadIdentity: "true") with Helm OCI registries on Azure sovereign clouds, the repo-server fails to pull charts from ACR with401 Unauthorized.Root Cause
In
util/helm/creds.go, the ARM token scope for the ACR refresh token exchange is hardcoded to the commercial endpoint:On sovereign clouds, the ARM resource endpoint differs. The token is obtained with the correct authority (
AZURE_AUTHORITY_HOSTis properly injected by the WI webhook), but the token audience/scope targets the commercial ARM resource, which the sovereign ACR/oauth2/exchangeendpoint rejects.Fix
Resolve the ARM token resource from
AZURE_AUTHORITY_HOST— the only cloud-identifying env var injected by the AKS Workload Identity mutating webhook into workload pods. (AZURE_ENVIRONMENTis NOT injected into pods, only into the webhook controller itself.)Ref: https://azure.github.io/azure-workload-identity/docs/installation/mutating-admission-webhook.html
login.microsoftonline.commanagement.core.windows.netlogin.microsoftonline.usmanagement.core.usgovcloudapi.netlogin.partner.microsoftonline.cnmanagement.core.chinacloudapi.cnFor other cloud environments, operators can set
AZURE_ARM_TOKEN_RESOURCEenv var explicitly on the repo-server.Testing
401 Unauthorizedon everyGenerateManifestcall for Helm OCI chartsChecklist
DCO