From 62a6c9148b9f39b3f0f85458a94ad2cff2acd0b2 Mon Sep 17 00:00:00 2001 From: Aviral Takkar Date: Fri, 27 Mar 2026 20:46:52 +0000 Subject: [PATCH 1/3] feat(acr): add --endpoint-protocol parameter to az acr update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for configuring the endpoint protocol (IPv4 and/or IPv6) on Azure Container Registries via az acr update. Changes: - Add --endpoint-protocol parameter with enum values IPv4, IPv4AndIPv6 - Set instance.endpoint_protocol in acr_update_custom() when provided - Add help text example for updating endpoint protocol - Add test_acr_with_dual_stack_endpoints scenario test Requires azure-mgmt-containerregistry >= 15.1.0b1 with API version 2026-01-01-preview which includes the EndpointProtocol property on the Registry model. Validated on dogfood registry srcregistryaue (Australia East): - az acr update --endpoint-protocol IPv4AndIPv6 → success - az acr update --endpoint-protocol IPv4 → success Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/azure-cli/azure/cli/command_modules/acr/_help.py | 3 +++ .../azure/cli/command_modules/acr/_params.py | 1 + .../azure/cli/command_modules/acr/custom.py | 6 +++++- .../acr/tests/latest/test_acr_commands.py | 12 ++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/acr/_help.py b/src/azure-cli/azure/cli/command_modules/acr/_help.py index e6865fa8da4..2bafa530bfe 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_help.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_help.py @@ -1526,6 +1526,9 @@ - name: Enable regional endpoints on an existing registry. text: > az acr update -n myregistry --regional-endpoints enabled + - name: Update the endpoint protocol for an Azure Container Registry. + text: > + az acr update -n myregistry --endpoint-protocol IPv4AndIPv6 """ helps['acr webhook'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/acr/_params.py b/src/azure-cli/azure/cli/command_modules/acr/_params.py index 97e3e92cfb5..2fa6bfc25be 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_params.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_params.py @@ -134,6 +134,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements with self.argument_context('acr update', arg_group='Network Rule') as c: c.argument('data_endpoint_enabled', get_three_state_flag(), help="Enable dedicated data endpoint for client firewall configuration") + c.argument('endpoint_protocol', arg_type=get_enum_type(['IPv4', 'IPv4AndIPv6']), options_list=['--endpoint-protocol'], help="The endpoint protocol (IPv4 and/or IPv6) for the registry.") with self.argument_context('acr update') as c: c.argument('anonymous_pull_enabled', get_three_state_flag(), help="Enable registry-wide pull from unauthenticated clients") diff --git a/src/azure-cli/azure/cli/command_modules/acr/custom.py b/src/azure-cli/azure/cli/command_modules/acr/custom.py index 083ecf85edd..058b941bbc5 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/custom.py +++ b/src/azure-cli/azure/cli/command_modules/acr/custom.py @@ -160,7 +160,8 @@ def acr_update_custom(cmd, tags=None, allow_metadata_search=None, role_assignment_mode=None, - regional_endpoints=None): + regional_endpoints=None, + endpoint_protocol=None): if sku is not None: Sku = cmd.get_models('Sku') instance.sku = Sku(name=sku) @@ -192,6 +193,9 @@ def acr_update_custom(cmd, if regional_endpoints is not None: _configure_regional_endpoints(cmd, instance, sku, regional_endpoints) + if endpoint_protocol is not None: + instance.endpoint_protocol = endpoint_protocol + _handle_network_bypass(cmd, instance, allow_trusted_services) _handle_export_policy(cmd, instance, allow_exports) diff --git a/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py b/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py index 229f124b687..09154506360 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py +++ b/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py @@ -795,6 +795,18 @@ def test_acr_with_anonymous_pull(self, resource_group, resource_group_location): self.cmd('acr update --name {registry_name} --resource-group {rg} --anonymous-pull-enabled false', checks=[self.check('anonymousPullEnabled', False)]) + @ResourceGroupPreparer() + def test_acr_with_dual_stack_endpoints(self, resource_group, resource_group_location): + self.kwargs.update({ + 'registry_name': self.create_random_name('testreg', 20) + }) + self.cmd('acr create --name {registry_name} --resource-group {rg} --sku premium -l eastus', + checks=[self.check('endpointProtocol', 'IPv4')]) + self.cmd('acr update --name {registry_name} --resource-group {rg} --endpoint-protocol IPv4AndIPv6', + checks=[self.check('endpointProtocol', 'IPv4AndIPv6')]) + self.cmd('acr update --name {registry_name} --resource-group {rg} --endpoint-protocol IPv4', + checks=[self.check('endpointProtocol', 'IPv4')]) + @ResourceGroupPreparer() @live_only() def test_acr_create_invalid_name(self, resource_group): From 96992b77e09895907972065b04e9b89c958ebef5 Mon Sep 17 00:00:00 2001 From: Aviral Takkar Date: Mon, 30 Mar 2026 18:05:43 +0000 Subject: [PATCH 2/3] {ACR} Address PR feedback: mark endpoint-protocol as preview, mark test as live_only - Add is_preview=True to --endpoint-protocol parameter since the underlying API version (2026-01-01-preview) is in preview - Mark test_acr_with_dual_stack_endpoints as @live_only() since it requires live Azure credentials for registry creation Addresses review comments from Copilot and CI test failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/azure-cli/azure/cli/command_modules/acr/_params.py | 2 +- .../cli/command_modules/acr/tests/latest/test_acr_commands.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/acr/_params.py b/src/azure-cli/azure/cli/command_modules/acr/_params.py index 2fa6bfc25be..a1eabaa02c2 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_params.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_params.py @@ -134,7 +134,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements with self.argument_context('acr update', arg_group='Network Rule') as c: c.argument('data_endpoint_enabled', get_three_state_flag(), help="Enable dedicated data endpoint for client firewall configuration") - c.argument('endpoint_protocol', arg_type=get_enum_type(['IPv4', 'IPv4AndIPv6']), options_list=['--endpoint-protocol'], help="The endpoint protocol (IPv4 and/or IPv6) for the registry.") + c.argument('endpoint_protocol', arg_type=get_enum_type(['IPv4', 'IPv4AndIPv6']), options_list=['--endpoint-protocol'], is_preview=True, help="The endpoint protocol (IPv4 and/or IPv6) for the registry.") with self.argument_context('acr update') as c: c.argument('anonymous_pull_enabled', get_three_state_flag(), help="Enable registry-wide pull from unauthenticated clients") diff --git a/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py b/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py index 09154506360..303c122cb2e 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py +++ b/src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands.py @@ -796,6 +796,7 @@ def test_acr_with_anonymous_pull(self, resource_group, resource_group_location): checks=[self.check('anonymousPullEnabled', False)]) @ResourceGroupPreparer() + @live_only() def test_acr_with_dual_stack_endpoints(self, resource_group, resource_group_location): self.kwargs.update({ 'registry_name': self.create_random_name('testreg', 20) From 1ba0f85f3038266f3c3df318abe7d52f693101fa Mon Sep 17 00:00:00 2001 From: Aviral Takkar Date: Mon, 6 Apr 2026 17:28:27 +0000 Subject: [PATCH 3/3] docs(acr): clarify allowed values for --endpoint-protocol help text Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/azure-cli/azure/cli/command_modules/acr/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/acr/_params.py b/src/azure-cli/azure/cli/command_modules/acr/_params.py index a1eabaa02c2..27f8cd3d591 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_params.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_params.py @@ -134,7 +134,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements with self.argument_context('acr update', arg_group='Network Rule') as c: c.argument('data_endpoint_enabled', get_three_state_flag(), help="Enable dedicated data endpoint for client firewall configuration") - c.argument('endpoint_protocol', arg_type=get_enum_type(['IPv4', 'IPv4AndIPv6']), options_list=['--endpoint-protocol'], is_preview=True, help="The endpoint protocol (IPv4 and/or IPv6) for the registry.") + c.argument('endpoint_protocol', arg_type=get_enum_type(['IPv4', 'IPv4AndIPv6']), options_list=['--endpoint-protocol'], is_preview=True, help="The endpoint protocol for the registry. Allowed values: IPv4, IPv4AndIPv6.") with self.argument_context('acr update') as c: c.argument('anonymous_pull_enabled', get_three_state_flag(), help="Enable registry-wide pull from unauthenticated clients")