Skip to content
Merged
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def default_api_version(self):
'role_definitions': '2018-01-01-preview',
'provider_operations_metadata': '2018-01-01-preview'
}),
ResourceType.MGMT_CONTAINERREGISTRY: '2019-12-01-preview',
ResourceType.MGMT_CONTAINERREGISTRY: '2020-11-01-preview',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pls help to make sure run full live test for regression. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have re-run tests, please can you review @yungezz

ResourceType.DATA_KEYVAULT: '7.0',
ResourceType.DATA_PRIVATE_KEYVAULT: '7.2',
ResourceType.DATA_KEYVAULT_ADMINISTRATION_BACKUP: '7.2-preview',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

VERSION_2019_05_01_PREVIEW = "2019-05-01-preview"
VERSION_2019_06_01_PREVIEW = "2019-06-01-preview"
VERSION_2020_11_01_PREVIEW = "2020-11-01-preview"


def get_acr_service_client(cli_ctx, api_version=None):
Expand Down Expand Up @@ -48,15 +49,15 @@ def cf_acr_runs(cli_ctx, *_):


def cf_acr_scope_maps(cli_ctx, *_):
return get_acr_service_client(cli_ctx, VERSION_2019_05_01_PREVIEW).scope_maps
return get_acr_service_client(cli_ctx, VERSION_2020_11_01_PREVIEW).scope_maps


def cf_acr_tokens(cli_ctx, *_):
return get_acr_service_client(cli_ctx, VERSION_2019_05_01_PREVIEW).tokens
return get_acr_service_client(cli_ctx, VERSION_2020_11_01_PREVIEW).tokens


def cf_acr_token_credentials(cli_ctx, *_):
return get_acr_service_client(cli_ctx, VERSION_2019_05_01_PREVIEW).registries
return get_acr_service_client(cli_ctx, VERSION_2020_11_01_PREVIEW).registries


def cf_acr_agentpool(cli_ctx, *_):
Expand Down
6 changes: 4 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acr/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@

def load_arguments(self, _): # pylint: disable=too-many-statements
SkuName, PasswordName, DefaultAction, PolicyStatus, WebhookAction, WebhookStatus, TaskStatus, \
BaseImageTriggerType, RunStatus, SourceRegistryLoginMode, UpdateTriggerPayloadType, TokenStatus = self.get_models(
BaseImageTriggerType, RunStatus, SourceRegistryLoginMode, UpdateTriggerPayloadType, \
TokenStatus, ZoneRedundancy = self.get_models(
'SkuName', 'PasswordName', 'DefaultAction', 'PolicyStatus', 'WebhookAction', 'WebhookStatus',
'TaskStatus', 'BaseImageTriggerType', 'RunStatus', 'SourceRegistryLoginMode', 'UpdateTriggerPayloadType',
'TokenStatus')
'TokenStatus', 'ZoneRedundancy')

with self.argument_context('acr') as c:
c.argument('tags', arg_type=tags_type)
Expand All @@ -75,6 +76,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
# Overwrite default shorthand of cmd to make availability for acr usage
c.argument('cmd', options_list=['--__cmd__'])
c.argument('cmd_value', help="Commands to execute.", options_list=['--cmd'])
c.argument('zone_redundancy', is_preview=True, arg_type=get_enum_type(ZoneRedundancy), help="Indicates whether or not zone redundancy should be enabled for this registry or replication. For more information, such as supported locations, please visit https://aka.ms/acr/az. Zone-redundancy cannot be updated. Defaults to 'Disabled'.")

for scope in ['acr create', 'acr update']:
with self.argument_context(scope, arg_group='Network Rule') as c:
Expand Down
11 changes: 8 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acr/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ def acr_create(cmd,
location=None,
admin_enabled=False,
default_action=None,
tags=None,
workspace=None,
identity=None,
key_encryption_key=None,
public_network_enabled=None):
public_network_enabled=None,
zone_redundancy=None,
tags=None):

if default_action and sku not in get_premium_sku(cmd):
raise CLIError(NETWORK_RULE_NOT_SUPPORTED)
Expand All @@ -53,7 +54,8 @@ def acr_create(cmd,
raise CLIError("Classic SKU is no longer supported. Please select a managed SKU.")

Registry, Sku, NetworkRuleSet = cmd.get_models('Registry', 'Sku', 'NetworkRuleSet')
registry = Registry(location=location, sku=Sku(name=sku), admin_user_enabled=admin_enabled, tags=tags)
registry = Registry(location=location, sku=Sku(name=sku), admin_user_enabled=admin_enabled,
zone_redundancy=zone_redundancy, tags=tags)
if default_action:
registry.network_rule_set = NetworkRuleSet(default_action=default_action)

Expand Down Expand Up @@ -463,6 +465,9 @@ def remove_identity(cmd, client, registry_name, identities, resource_group_name=
registry.identity.type = (ResourceIdentityType.none
if registry.identity.type == ResourceIdentityType.system_assigned
else ResourceIdentityType.user_assigned)
# if we have no system assigned identitiy then set identity object to none
registry.identity.principal_id = None
registry.identity.tenant_id = None

if remove_user_identities:
subscription_id = get_subscription_id(cmd.cli_ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def acr_replication_create(cmd,
resource_group_name=None,
replication_name=None,
region_endpoint_enabled=None,
zone_redundancy=None,
tags=None):
registry, resource_group_name = validate_premium_registry(
cmd, registry_name, resource_group_name, REPLICATIONS_NOT_SUPPORTED)
Expand All @@ -42,13 +43,15 @@ def acr_replication_create(cmd,
ReplicationType = cmd.get_models('Replication')

replication_name = replication_name or normalized_location
replication_properties = ReplicationType(
location=location, region_endpoint_enabled=region_endpoint_enabled, zone_redundancy=zone_redundancy)

try:
return client.create(
resource_group_name=resource_group_name,
registry_name=registry_name,
replication_name=replication_name,
replication=ReplicationType(location=location, region_endpoint_enabled=region_endpoint_enabled),
replication=replication_properties,
tags=tags
)
except ValidationError as e:
Expand Down
Loading