[AKS] az aks check-acr: Support national/sovereign clouds that report cloud=AzureStackCloud#33551
Merged
Merged
Conversation
…kCloud Set AZURE_ENVIRONMENT_FILEPATH on the canipull pod so go-autorest can resolve the cloud environment from /etc/kubernetes/akscustom.json on national/sovereign cloud nodes where azure.json reports cloud=AzureStackCloud.
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates az aks check-acr to work on AKS clusters in national/sovereign clouds where node provisioning reports cloud=AzureStackCloud and provides the cloud metadata in /etc/kubernetes/akscustom.json. It does so by injecting AZURE_ENVIRONMENT_FILEPATH=/etc/kubernetes/akscustom.json into the canipull pod, enabling go-autorest to resolve the AzureStackCloud environment and allowing the ACR/MSI checks to proceed.
Changes:
- Adds
AZURE_ENVIRONMENT_FILEPATHto thecanipullcontainer spec overrides used byaz aks check-acr. - Documents in-line why the env var is needed and why it is safe for non-AzureStackCloud clusters.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
az aks check-acr: Support national/sovereign clouds that report cloud=AzureStackCloud
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Collaborator
|
AKS |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
yanzhudd
approved these changes
Jun 16, 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.
Related command
az aks check-acrDescription
On AKS clusters in national/sovereign clouds (e.g. Bleu), node provisioning stamps
"cloud": "AzureStackCloud"into/etc/kubernetes/azure.json(reusing the Stack identifier as a catch-all for non-public clouds) and writes the cloud-specific endpoints to a companion/etc/kubernetes/akscustom.jsonfile (a go-autorestazure.Environmentdocument).az aks check-acrruns thecanipullcontainer, which calls go-autorest'sazure.EnvironmentFromName(cfg.Cloud). ForAzureStackCloud, go-autorest only resolves the environment whenAZURE_ENVIRONMENT_FILEPATHpoints at such a metadata file. Because the wrapper never set this env var, the very first step of the managed-identity / service-principal validation failed and the tool exited withUnknown Azure cloud name: AzureStackCloud— before any MSI / token / ACR check ran. DNS, CNAME and ACR location detection all succeeded; only the cloud-name resolution aborted. There was no flag or invocation to work around it, making the command unusable on every cluster in these clouds.This change sets
AZURE_ENVIRONMENT_FILEPATH=/etc/kubernetes/akscustom.jsonon the canipull container. The pod already hostPath-mounts the node's/etc/kubernetes, so the companion file is present, and go-autorest can build the environment from it. The same file is already consumed successfully by the in-cluster CSI node drivers on these nodes, confirming the schema and mechanism.This is safe for public clouds: go-autorest ignores
AZURE_ENVIRONMENT_FILEPATHunless the cloud name isAzureStackCloud, so AzureCloud / AzureChinaCloud / AzureUSGovernment clusters are unaffected.Related issue: Azure/aks-canipull#21
Testing Guide
On an AKS cluster in a sovereign cloud whose nodes report
"cloud": "AzureStackCloud"in/etc/kubernetes/azure.jsonand ship/etc/kubernetes/akscustom.json:Before: fails with
Unknown Azure cloud name: AzureStackCloud.After: canipull proceeds past cloud resolution and performs the managed-identity / ACR pull checks.
Public-cloud clusters continue to work unchanged (the env var is ignored when the cloud is not
AzureStackCloud).History Notes
[AKS]
az aks check-acr: Support national/sovereign clouds where nodes reportcloud=AzureStackCloudby pointing canipull at the on-nodeakscustom.jsonenvironment fileThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.