Skip to content

[ACR] add new acrregionalendpoint extension for private preview of ACR Regional Endpoints feature#9500

Closed
lizMSFT wants to merge 13 commits intoAzure:mainfrom
lizMSFT:acrregionalendpoint
Closed

[ACR] add new acrregionalendpoint extension for private preview of ACR Regional Endpoints feature#9500
lizMSFT wants to merge 13 commits intoAzure:mainfrom
lizMSFT:acrregionalendpoint

Conversation

@lizMSFT
Copy link
Member

@lizMSFT lizMSFT commented Jan 6, 2026

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/show
az acr show-endpoints
az acr login
az acr import

Description

Changes Introduced:

  • Initial preview release for Azure Container Registry regional endpoints support.
  • Add: --regional-endpoints parameter to az acr create and az acr update commands to enable regional endpoint functionality.
  • Add: --endpoint parameter to az acr login command to authenticate against a specific regional endpoint.
  • Add: Enhanced az acr show command to display regionalEndpoints and regionalEndpointHostNames properties in registry information.
  • Add: Enhanced az acr show-endpoints command to display comprehensive endpoint information including registry login server, data endpoints, and regional endpoints.
  • Add: Enhanced az acr import command to automatically detect and handle regional endpoint URIs in source image specifications.

Testing

az acr create:
image

az acr update:
image

az acr show:
image

az acr show-endpoints:
az_acr_show_endpoints

az acr login:
image
image
image

az acr import:
az_acr_import

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

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.json automatically.
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.

Copilot AI review requested due to automatic review settings January 6, 2026 22:09
@azure-client-tools-bot-prd
Copy link

Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link

Hi @lizMSFT,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 6, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

@github-actions github-actions bot added the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Jan 6, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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)

@github-actions github-actions bot removed the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Jan 7, 2026
@@ -0,0 +1,401 @@
# --------------------------------------------------------------------------------------------
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,184 @@
# --------------------------------------------------------------------------------------------
Copy link
Member Author

Choose a reason for hiding this comment

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

@lizMSFT lizMSFT requested a review from savaradh January 12, 2026 20:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 38 out of 43 changed files in this pull request and generated 8 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 38 out of 43 changed files in this pull request and generated 2 comments.


return info


Copy link
Member Author

Choose a reason for hiding this comment

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

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)

Copy link

@huanwu huanwu left a comment

Choose a reason for hiding this comment

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

submit comment

Copy link

@huanwu huanwu left a comment

Choose a reason for hiding this comment

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

post review comments

@yanzhudd
Copy link
Contributor

yanzhudd commented Feb 8, 2026

/azp run

@azure-pipelines
Copy link

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)
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, what does this one do? Do we need this here?

Copy link
Member Author

Choose a reason for hiding this comment

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

_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

https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/acr/custom.py#L125

return RegistryUpdateParameters()


def acr_update_set_preview(cmd, client, registry_name, resource_group_name=None, parameters=None):
Copy link
Member

Choose a reason for hiding this comment

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

Should we change the args list to new line as in other methods? Does this fail python formatter check?

Copy link
Member Author

Choose a reason for hiding this comment

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

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)
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Member Author

@lizMSFT lizMSFT Feb 9, 2026

Choose a reason for hiding this comment

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

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:
Copy link
Member

Choose a reason for hiding this comment

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

Should this section be common for all calls? create/update/set? Should it move to _configure_regional_endpoints method?

Copy link
Member Author

Choose a reason for hiding this comment

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

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

@yanzhudd
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@yanzhudd
Copy link
Contributor

Hi @lizMSFT
is this PR ready to review/merge?

@lizMSFT lizMSFT closed this Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants