Repository navigation
[ACR] az acr import: Add cross-tenant import support - #34210
Bin Du (northtyphoon) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Managed-identity and Cloud Shell logins silently omit the auxiliary token, causing advertised cross-tenant imports to fail.
1 open finding
What changed in this PR
Adds cross-tenant ACR image imports using auxiliary ARM authentication.
Changes:
- Adds
--registry-tenantwith validation and help. - Uses an auxiliary tenant when creating the import client.
- Adds focused client-factory tests.
| File | Description |
|---|---|
_client_factory.py |
Validates source registry IDs and configures auxiliary authentication. |
commands.py |
Registers the import-specific client factory. |
_params.py |
Defines --registry-tenant. |
_help.py |
Adds a cross-tenant example. |
test_acr_client_factory.py |
Tests validation and tenant forwarding. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| raise ArgumentUsageError(REGISTRY_TENANT_USAGE_ERROR) | ||
|
|
||
| aux_tenants = [registry_tenant] if registry_tenant else None | ||
| return get_acr_service_client(cli_ctx, aux_tenants=aux_tenants).registries |
There was a problem hiding this comment.
Addressed in 4136ed7. --registry-tenant now rejects managed identity and Cloud Shell login modes before client creation, with focused unit coverage.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Please fix CI issues |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pushed 4136ed7 to address the review and linter failures: exposed |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Fixed the pylint failure in 1f54ef5. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |

Related command
az acr importDescription
Add
--registry-tenantto support importing images from an Azure Container Registry in another tenant.When specified, Azure CLI uses the current identity to acquire an auxiliary ARM token for the source registry tenant and includes it on the import management API request. The option is accepted only when
--registryis a Container Registry resource ID; registry names, login servers, missing registry values, and non-ACR resource IDs are rejected.This change also adds command help and a cross-tenant example.
Testing Guide
Confirm that help includes
--registry-tenant, and that using it with a registry name fails before an import request is sent.