Skip to content

[AKS] az aks check-acr: Support national/sovereign clouds that report cloud=AzureStackCloud#33551

Merged
yanzhudd merged 1 commit into
Azure:devfrom
FumingZhang:acs/check-acr-sovereign-cloud
Jun 16, 2026
Merged

[AKS] az aks check-acr: Support national/sovereign clouds that report cloud=AzureStackCloud#33551
yanzhudd merged 1 commit into
Azure:devfrom
FumingZhang:acs/check-acr-sovereign-cloud

Conversation

@FumingZhang

Copy link
Copy Markdown
Member

Related command
az aks check-acr

Description
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.json file (a go-autorest azure.Environment document).

az aks check-acr runs the canipull container, which calls go-autorest's azure.EnvironmentFromName(cfg.Cloud). For AzureStackCloud, go-autorest only resolves the environment when AZURE_ENVIRONMENT_FILEPATH points 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 with Unknown 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.json on 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_FILEPATH unless the cloud name is AzureStackCloud, 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.json and ship /etc/kubernetes/akscustom.json:

az aks check-acr --name MyManagedCluster --resource-group MyResourceGroup --acr myacr.<sovereign-acr-suffix>

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 report cloud=AzureStackCloud by pointing canipull at the on-node akscustom.json environment file


This checklist is used to make sure that common guidelines for a pull request are followed.

…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.
Copilot AI review requested due to automatic review settings June 15, 2026 01:05
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 15, 2026

Copy link
Copy Markdown
️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.14
️✔️acs
️✔️latest
️✔️3.12
️✔️3.14
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.14
️✔️ams
️✔️latest
️✔️3.12
️✔️3.14
️✔️apim
️✔️latest
️✔️3.12
️✔️3.14
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.14
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️aro
️✔️latest
️✔️3.12
️✔️3.14
️✔️backup
️✔️latest
️✔️3.12
️✔️3.14
️✔️batch
️✔️latest
️✔️3.12
️✔️3.14
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.14
️✔️billing
️✔️latest
️✔️3.12
️✔️3.14
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.14
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.14
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.14
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.14
️✔️config
️✔️latest
️✔️3.12
️✔️3.14
️✔️configure
️✔️latest
️✔️3.12
️✔️3.14
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.14
️✔️container
️✔️latest
️✔️3.12
️✔️3.14
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.14
️✔️core
️✔️latest
️✔️3.12
️✔️3.14
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.14
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.14
️✔️dls
️✔️latest
️✔️3.12
️✔️3.14
️✔️dms
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.14
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.14
️✔️find
️✔️latest
️✔️3.12
️✔️3.14
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.14
️✔️identity
️✔️latest
️✔️3.12
️✔️3.14
️✔️iot
️✔️latest
️✔️3.12
️✔️3.14
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.14
️✔️lab
️✔️latest
️✔️3.12
️✔️3.14
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️maps
️✔️latest
️✔️3.12
️✔️3.14
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.14
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.14
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.14
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.14
️✔️network
️✔️latest
️✔️3.12
️✔️3.14
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.14
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.14
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.14
️✔️profile
️✔️latest
️✔️3.12
️✔️3.14
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.14
️✔️redis
️✔️latest
️✔️3.12
️✔️3.14
️✔️relay
️✔️latest
️✔️3.12
️✔️3.14
️✔️resource
️✔️latest
️✔️3.12
️✔️3.14
️✔️role
️✔️latest
️✔️3.12
️✔️3.14
️✔️search
️✔️latest
️✔️3.12
️✔️3.14
️✔️security
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.14
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.14
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.14
️✔️sql
️✔️latest
️✔️3.12
️✔️3.14
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.14
️✔️storage
️✔️latest
️✔️3.12
️✔️3.14
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.14
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.14
️✔️util
️✔️latest
️✔️3.12
️✔️3.14
️✔️vm
️✔️latest
️✔️3.12
️✔️3.14

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 15, 2026

Copy link
Copy Markdown
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_FILEPATH to the canipull container spec overrides used by az 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.

@FumingZhang FumingZhang changed the title [AKS] az aks check-acr: Support national/sovereign clouds that report cloud=AzureStackCloud [AKS] az aks check-acr: Support national/sovereign clouds that report cloud=AzureStackCloud Jun 15, 2026
@FumingZhang

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@yonzhan

yonzhan commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

AKS

@FumingZhang

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd yanzhudd merged commit ab69973 into Azure:dev Jun 16, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad AKS az aks/acs/openshift Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants