[ACR] add new acrregionalendpoint extension for private preview of ACR Regional Endpoints feature#9500
[ACR] add new acrregionalendpoint extension for private preview of ACR Regional Endpoints feature#9500lizMSFT wants to merge 13 commits intoAzure:mainfrom
Conversation
…R Regional Endpoints feature
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Hi @lizMSFT, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
There was a problem hiding this comment.
Pull request overview
This pull request adds a new Azure CLI extension called "acrregionalendpoint" for the private preview of the ACR Regional Endpoints feature. The extension provides management capabilities for Azure Container Registry regional endpoints.
Key changes:
- New extension scaffolding with version 1.0.0
- Vendored Azure Container Registry Management SDK
- Support for API version 2025-12-01-preview
Reviewed changes
Copilot reviewed 38 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Extension metadata, dependencies, and packaging configuration |
| azext_metadata.json | Extension configuration marking it as preview with minimum CLI version 2.80.0 |
| vendored_sdks/containerregistry/ | Auto-generated Container Registry Management SDK code |
| _configuration.py (sync/async) | SDK configuration with API version 2025-12-01-preview |
| models/ | Auto-generated model classes and enums for the SDK |
| operations/ | Auto-generated operation classes for SDK functionality |
| tests/ | Test structure setup (placeholder files) |
| @@ -0,0 +1,401 @@ | |||
| # -------------------------------------------------------------------------------------------- | |||
There was a problem hiding this comment.
| @@ -0,0 +1,184 @@ | |||
| # -------------------------------------------------------------------------------------------- | |||
There was a problem hiding this comment.
...regionalendpoint/azext_acrregionalendpoint/vendored_sdks/containerregistry/_configuration.py
Show resolved
Hide resolved
...onalendpoint/azext_acrregionalendpoint/vendored_sdks/containerregistry/aio/_configuration.py
Show resolved
Hide resolved
src/acrregionalendpoint/azext_acrregionalendpoint/tests/latest/recordings/test_acr_login.yaml
Outdated
Show resolved
Hide resolved
...egionalendpoint/tests/latest/recordings/test_acr_create_with_regional_endpoint_disabled.yaml
Outdated
Show resolved
Hide resolved
...regionalendpoint/tests/latest/recordings/test_acr_create_with_regional_endpoint_enabled.yaml
Outdated
Show resolved
Hide resolved
...egionalendpoint/azext_acrregionalendpoint/tests/latest/test_acr_regionalendpoint_scenario.py
Show resolved
Hide resolved
|
|
||
| return info | ||
|
|
||
|
|
There was a problem hiding this comment.
Copied the functions below from azure.cli.command_modules.acr.custom due to potential upcoming changes on the CLI side.
More details in: Azure/azure-sdk-for-python#44775 (comment)
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
| dnl_scope=None, | ||
| role_assignment_mode=None, | ||
| regional_endpoints=None): | ||
| from azure.cli.command_modules.acr.custom import (_create_diagnostic_settings) |
There was a problem hiding this comment.
Just curious, what does this one do? Do we need this here?
There was a problem hiding this comment.
_create_diagnostic_settings is used on line 110. The original az acr create command supports this functionality:
--workspace [Preview] : Name or ID of the Log Analytics workspace to send
registry diagnostic logs to. All events will be enabled. You
can use "az monitor log-analytics workspace create" to
create one. Extra billing may apply.
Argument '--workspace' is in preview and under development. Reference and support
levels: https://aka.ms/CLI_refstatus
| return RegistryUpdateParameters() | ||
|
|
||
|
|
||
| def acr_update_set_preview(cmd, client, registry_name, resource_group_name=None, parameters=None): |
There was a problem hiding this comment.
Should we change the args list to new line as in other methods? Does this fail python formatter check?
There was a problem hiding this comment.
The project's pylintrc sets max-line-length=120, so this should be fine and won't fail the lint check
| from azure.core.exceptions import ResourceNotFoundError, HttpResponseError | ||
| resource_group_name = get_resource_group_name_by_registry_name(cmd.cli_ctx, registry_name, resource_group_name) | ||
| try: | ||
| return client.get(resource_group_name, registry_name) |
There was a problem hiding this comment.
Why this change? It does not use this fallback in azure-cli repo? Should that be updated as well? Also nit: rearranging the methods order as per the azure-cli repo will help render diff better when doing review. Just a nit
There was a problem hiding this comment.
nit: rearranging the methods order as per the azure-cli repo will help render diff better when doing review
Thanks for the suggestion, I will do this next time. I also realized this PR became harder to review after completing the full implementation. I will commit the original azure-cli code first to keep the diff cleaner in the future.
Regarding the function: it now uses the new preview-version client by default (so we can return the regional endpoint fields). The fallback to the standard client ensures that the command still works when the new preview API isn't available, preventing the entire feature from breaking.
| # Determine the effective SKU (new SKU if being updated, otherwise current SKU) | ||
| sku = parameters.sku.name if parameters.sku else registry.sku.name | ||
|
|
||
| if parameters.regional_endpoints == RegionalEndpoints.ENABLED: |
There was a problem hiding this comment.
Should this section be common for all calls? create/update/set? Should it move to _configure_regional_endpoints method?
There was a problem hiding this comment.
We had this check on line 218
def _configure_regional_endpoints(cmd, registry, sku, regional_endpoints):
if not _check_regional_endpoints_afec(cmd.cli_ctx):
raise CLIError(
"usage error: The --regional-endpoints parameter is only applicable to"
" subscriptions registered with feature {}".format(ACR_AFEC_REGIONAL_ENDPOINT)
)
if regional_endpoints == RegionalEndpoints.ENABLED and sku and sku not in get_premium_sku(cmd):
raise CLIError(REGIONAL_ENDPOINTS_NOT_SUPPORTED)
registry.regional_endpoints = regional_endpoints
I added this additional check because when a user runs az acr update without specifying a SKU, we first need to retrieve the current SKU before performing the validation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Hi @lizMSFT |
DO NOT MERGE
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az acr create/update/showaz acr show-endpointsaz acr loginaz acr importDescription
Changes Introduced:
--regional-endpointsparameter toaz acr createandaz acr updatecommands to enable regional endpoint functionality.--endpointparameter toaz acr logincommand to authenticate against a specific regional endpoint.az acr showcommand to displayregionalEndpointsandregionalEndpointHostNamesproperties in registry information.az acr show-endpointscommand to display comprehensive endpoint information including registry login server, data endpoints, and regional endpoints.az acr importcommand to automatically detect and handle regional endpoint URIs in source image specifications.Testing
az acr create:az acr update:az acr show:az acr show-endpoints:az acr login:az acr import:General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.