[ACR] az acr import: Fix regional endpoint source resolution for multi-label sovereign suffixes#33754
Open
lizMSFT wants to merge 2 commits into
Open
[ACR] az acr import: Fix regional endpoint source resolution for multi-label sovereign suffixes#33754lizMSFT wants to merge 2 commits into
az acr import: Fix regional endpoint source resolution for multi-label sovereign suffixes#33754lizMSFT wants to merge 2 commits into
Conversation
…i-label sovereign suffixes _regional_endpoint_uri_to_login_server assumed a fixed 5-part hostname (<registry>.<region>.geo.azurecr.io), so sovereign login-server suffixes with more than one label (e.g. azurecr.sovcloud-azure.de) were left unconverted. The source then fell back to an anonymous cross-firewall pull and failed with 403 DENIED. Strip the ".geo<suffix>" tail instead of counting dot-separated parts, making conversion suffix-length-agnostic. Add unit coverage for sovereign (delos .de, bleu .fr) and DNL registries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6daaab37-9f50-49e2-bbba-9dd6ff4b3727
|
Hi @lizMSFT, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates az acr import to correctly normalize regional endpoint source registries back to the global login server when the login-server suffix contains multiple DNS labels (common in sovereign clouds). This ensures the command continues to use the fast resource-id based import path instead of falling back to anonymous registryUri pulls that can fail behind firewalls.
Changes:
- Updated
_regional_endpoint_uri_to_login_serverto strip the.geo<suffix>tail instead of assuming a fixed dot-part count. - Added unit tests covering multi-label sovereign suffixes (e.g.,
.azurecr.sovcloud-azure.de/.fr) and DNL registry names. - Extended non-regional pass-through test coverage for sovereign-style hostnames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acr/import.py | Makes regional endpoint normalization suffix-length-agnostic by stripping .geo<suffix> rather than relying on fixed hostname part counts. |
| src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_regional_endpoint_utils.py | Adds/extends tests to validate regional endpoint conversion for multi-label sovereign suffixes and ensure non-regional URIs remain unchanged. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Reject regional endpoints with an empty region label (require both
<registry> and <region> to be non-empty) so malformed URIs like
"registry..geo<suffix>" are no longer converted.
- Clarify comment/docstring wording ("more than two labels") and drop a
stray space before a docstring's closing quotes.
- Add a unit case covering the empty-region rejection.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6daaab37-9f50-49e2-bbba-9dd6ff4b3727
Collaborator
|
ACR |
Contributor
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
yanzhudd
approved these changes
Jul 22, 2026
huanwu
approved these changes
Jul 22, 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 acr importDescription
az acr importresolves the--sourceregistry to a login server in the CLI before the request reaches the RP. When the source is a regional endpoint (<registry>.<region>.geo<suffix>),_regional_endpoint_uri_to_login_servernormalizes it back to the global login server so import can use the fast resource-id (blob copy) path.The old implementation assumed a fixed 5-part hostname:
This only holds when the login-server suffix is exactly two labels (
azurecr.io). Sovereign clouds use multi-label suffixes — e.g. delosazurecr.sovcloud-azure.de, bleuazurecr.sovcloud-azure.fr— so a regional endpoint likemyregistry.germanycentral.geo.azurecr.sovcloud-azure.dehas 6 parts, the check fails, and the URI is returned unchanged. Import then falls back to aregistryUrisource, which the RP pulls anonymously over HTTP across the source registry's firewall, failing with:This PR strip the known
.geo<suffix>tail and take the remaining<registry>.<region>(require exactly 2 prefix parts). This is suffix-length-agnostic, so it works for public and sovereign clouds while leaving global/non-regional login servers unchanged.Testing Guide
Added unit cases in
test_regional_endpoint_utils.pycovering sovereign suffixes (delos.de, bleu.fr), DNL registries, and global/non-geo pass-through.History Notes
[ACR]
az acr import: Fix regional endpoint source resolution for sovereign clouds with multi-label login-server suffixesThis 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.
🤖 PR Validation — ️✔️ All clear