Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acr/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@
- name: Create a managed container registry with the Premium SKU and regional endpoints enabled.
text: >
az acr create -n myregistry -g MyResourceGroup --sku Premium --regional-endpoints enabled
- name: Create a managed container registry with the Premium SKU and dual-stack (IPv4 and IPv6) endpoint protocol.
text: >
az acr create -n myregistry -g MyResourceGroup --sku Premium --data-endpoint-enabled true --endpoint-protocol IPv4AndIPv6
"""

helps['acr credential'] = """
Expand Down
7 changes: 4 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acr/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
with self.argument_context('acr create') as c:
c.argument('dnl_scope', options_list=['--dnl-scope'], help='Domain name label scope will add a hash to the resource name. The resulting login server name will be in the format `registryname`-`hash`.azurecr-io. Default is Unsecure.', is_preview=True, arg_type=get_enum_type(AutoGeneratedDomainNameLabelScope))

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 for the registry. Allowed values: IPv4, IPv4AndIPv6.")
for scope in ['acr create', 'acr update']:
with self.argument_context(scope, 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 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")
Expand Down
10 changes: 9 additions & 1 deletion src/azure-cli/azure/cli/command_modules/acr/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def acr_create(cmd,
allow_metadata_search=None,
dnl_scope=None,
role_assignment_mode=None,
regional_endpoints=None):
regional_endpoints=None,
data_endpoint_enabled=None,
endpoint_protocol=None):
if default_action and sku not in get_premium_sku(cmd):
raise CLIError(NETWORK_RULE_NOT_SUPPORTED)

Expand Down Expand Up @@ -114,6 +116,12 @@ def acr_create(cmd,
if regional_endpoints is not None:
_configure_regional_endpoints(cmd, registry, sku, regional_endpoints)

if data_endpoint_enabled is not None:
registry.data_endpoint_enabled = data_endpoint_enabled

if endpoint_protocol is not None:
registry.endpoint_protocol = endpoint_protocol

_handle_network_bypass(cmd, registry, allow_trusted_services)
_handle_export_policy(cmd, registry, allow_exports)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,35 @@ def test_acr_with_dual_stack_endpoints(self, resource_group, resource_group_loca
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_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 '
'--data-endpoint-enabled true --endpoint-protocol IPv4AndIPv6',
checks=[self.check('endpointProtocol', 'IPv4AndIPv6'),
self.check('dataEndpointEnabled', True)])
self.cmd('acr update --name {registry_name} --resource-group {rg} --endpoint-protocol IPv4',
checks=[self.check('endpointProtocol', 'IPv4')])
self.cmd('acr update --name {registry_name} --resource-group {rg} --endpoint-protocol IPv4AndIPv6',
checks=[self.check('endpointProtocol', 'IPv4AndIPv6')])

@ResourceGroupPreparer()
@live_only()
def test_acr_create_with_data_endpoint(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 '
'--data-endpoint-enabled true',
checks=[self.check('dataEndpointEnabled', True)])
self.cmd('acr update --name {registry_name} --resource-group {rg} --data-endpoint-enabled false',
checks=[self.check('dataEndpointEnabled', False)])
self.cmd('acr update --name {registry_name} --resource-group {rg} --data-endpoint-enabled true',
checks=[self.check('dataEndpointEnabled', True)])

@ResourceGroupPreparer()
@live_only()
def test_acr_create_invalid_name(self, resource_group):
Expand Down
Loading