Skip to content
Merged
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
38 changes: 19 additions & 19 deletions src/command_modules/azure-cli-acr/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Commands to manage Azure container registries
Subgroups:
credential: Manage admin user credential for Azure container registries.
repository: Manage repositories for Azure container registries.
storage : Manage storage accounts for Azure container registries.

Commands:
check-name: Check whether the container registry name is available.
create : Create a container registry.
delete : Delete a container registry.
list : List container registries.
Expand All @@ -36,9 +36,9 @@ Create a container registry

Examples
Create a container registry with a new storage account
az acr create -n myRegistry -g myResourceGroup -l southus
az acr create -n myRegistry -g myResourceGroup -l southcentralus
Create a container registry with an existing storage account
az acr create -n myRegistry -g myResourceGroup -l southus -s myStorageAccount
az acr create -n myRegistry -g myResourceGroup -l southcentralus -s myStorageAccount

Delete a container registry
-------------
Expand Down Expand Up @@ -86,39 +86,39 @@ Update a container registry
az acr update: Update a container registry.

Arguments
--name -n [Required]: Name of container registry.
--disable-admin : Disable admin user.
--enable-admin : Enable admin user.
--resource-group -g : Name of resource group.
--tags : Space separated tags in 'key[=value]' format. Use "" to clear existing
tags.
--tenant-id -t : Tenant id for service principal login. Warning: Changing tenant id will
invalidate assigned access of existing service principals.
--name -n [Required]: Name of container registry.
--disable-admin : Disable admin user.
--enable-admin : Enable admin user.
--resource-group -g : Name of resource group.
--storage-account-name -s: Name of an existing storage account.
--tags : Space separated tags in 'key[=value]' format. Use "" to clear
existing tags.

Examples
Update tags for a container registry
az acr update -n myRegistry --tags key1=value1;key2=value2
az acr update -n myRegistry --tags key1=value1 key2=value2
Update storage account for a container registry
az acr update -n myRegistry -s myStorageAccount
Enable admin user for a container registry
az acr update -n myRegistry --enable-admin

Update storage account for a container registry
Get login credentials for a container registry
-------------
::

Command
az acr storage update: Update storage account for a container registry.
az acr credential show: Get login credentials for a container registry.

Arguments
--name -n [Required]: Name of container registry.
--storage-account-name -s [Required]: Name of an existing storage account.
--resource-group -g : Name of resource group.
--name -n [Required]: Name of container registry.
--resource-group -g : Name of resource group.

Get admin username and password for a container registry
Regenerate login credentials for a container registry
-------------
::

Command
az acr credential show: Get admin username and password for a container registry.
az acr credential renew: Regenerate login credentials for a container registry.

Arguments
--name -n [Required]: Name of container registry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
import azure.cli.command_modules.acr._help
import azure.cli.command_modules.acr._params
import azure.cli.command_modules.acr.custom
import azure.cli.command_modules.acr.storage
import azure.cli.command_modules.acr.credential
import azure.cli.command_modules.acr.repository

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

RESOURCE_PROVIDER = 'Microsoft.ContainerRegistry'
RESOURCE_TYPE = RESOURCE_PROVIDER + '/registries'
ACR_RESOURCE_PROVIDER = 'Microsoft.ContainerRegistry'
ACR_RESOURCE_TYPE = ACR_RESOURCE_PROVIDER + '/registries'
STORAGE_RESOURCE_TYPE = 'Microsoft.Storage/storageAccounts'
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Profile,
CLOUD
)
from azure.cli.core.cloud import CloudEndpoint
from azure.cli.core._config import az_config
from azure.mgmt.resource.resources import ResourceManagementClient
from azure.mgmt.storage import StorageManagementClient
Expand All @@ -18,8 +17,8 @@
)

from azure.cli.command_modules.acr.mgmt_acr import (
ContainerRegistry,
ContainerRegistryConfiguration,
ContainerRegistryManagementClient,
ContainerRegistryManagementClientConfiguration,
VERSION
)

Expand All @@ -42,12 +41,12 @@ def get_acr_service_client():
profile = Profile()
credentials, subscription_id, _ = profile.get_login_credentials()

config = ContainerRegistryConfiguration(
subscription_id,
get_acr_api_version(),
config = ContainerRegistryManagementClientConfiguration(
credentials,
base_url=CLOUD.endpoints[CloudEndpoint.RESOURCE_MANAGER])
client = ContainerRegistry(config)
subscription_id,
api_version=get_acr_api_version(),
base_url=CLOUD.endpoints.resource_manager)
client = ContainerRegistryManagementClient(config)

configure_common_settings(client)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@

from ._utils import get_resource_group_name_by_resource_id

_basic_map = {
_registry_map = {
'name': 'NAME',
'resourceGroup': 'RESOURCE GROUP',
'location': 'LOCATION',
'tags': 'TAGS'
}

_properties_map = {
'tags': 'TAGS',
'loginServer': 'LOGIN SERVER',
'creationDate': 'CREATION DATE',
'adminUserEnabled': 'ADMIN USER ENABLED'
Expand All @@ -25,8 +22,8 @@
}

_admin_user_map = {
'userName': 'USERNAME',
'passWord': 'PASSWORD'
'username': 'USERNAME',
'password': 'PASSWORD'
}

_order_map = {
Expand All @@ -53,29 +50,22 @@ def _format_registry(item):
'''Returns an ordered dictionary of the container registry.
:param dict item: The container registry object
'''
basic_info = {_basic_map[key]: str(item[key]) for key in item if key in _basic_map}
registry_info = {_registry_map[key]: str(item[key]) for key in item if key in _registry_map}

if 'id' in item and item['id']:
resource_group_name = get_resource_group_name_by_resource_id(item['id'])
basic_info['RESOURCE GROUP'] = resource_group_name
registry_info['RESOURCE GROUP'] = resource_group_name

properties_info = {}
storage_account_info = {}
if 'properties' in item and item['properties']:
properties = item['properties']
properties_info = {_properties_map[key]: str(properties[key])
for key in properties if key in _properties_map}

if 'storageAccount' in properties and properties['storageAccount']:
storage_account = properties['storageAccount']
storage_account_info = {_storage_account_map[key]: str(storage_account[key])
for key in storage_account if key in _storage_account_map}
if 'storageAccount' in item and item['storageAccount']:
storage_account = item['storageAccount']
storage_account_info = {_storage_account_map[key]: str(storage_account[key])
for key in storage_account if key in _storage_account_map}

admin_user_info = {_admin_user_map[key]: str(item[key])
for key in item if key in _admin_user_map}

all_info = basic_info.copy()
all_info.update(properties_info)
all_info = registry_info.copy()
all_info.update(storage_account_info)
all_info.update(admin_user_info)

Expand Down
Loading