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
25 changes: 11 additions & 14 deletions src/command_modules/azure-cli-acr/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Commands to manage Azure container registries
create : Creates a container registry.
delete : Deletes a container registry.
list : Lists all the available container registries under the current subscription.
login : Login to a container registry through Docker.
show : Gets the properties of the specified container registry.
update : Updates a container registry.

Expand Down Expand Up @@ -152,20 +153,6 @@ List repositories in a given container registry
List repositories in a given container registry with credentials
az acr repository list -n myRegistry -u myUsername -p myPassword

Login to a container registry
-------------
::

Command
az acr login: Login to a container registry through Docker.

Arguments
--registry-url -u [Required]: The login server of the container registry.

Examples
Login to a container registry
az acr login -u myregistry.azurecr.io

Show tags of a given repository in a given container registry
-------------
::
Expand All @@ -185,3 +172,13 @@ Show tags of a given repository in a given container registry
az acr repository show-tags -n myRegistry --repository myRepository
Show tags of a given repository in a given container registry with credentials
az acr repository show-tags -n myRegistry --repository myRepository -u myUsername -p myPassword

Login to a container registry
-------------
::

Command
az acr login: Login to a container registry through Docker.

Arguments
--name -n [Required]: The name of the container registry.
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@
az acr update -n myRegistry --admin-enabled true
"""

helps['acr login'] = """
type: command
short-summary: Login to a container registry through Docker.
examples:
- name: Login to a registry
text:
az acr login -u myregistry.azurecr.io
"""

helps['acr repository list'] = """
type: command
examples:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
options_list=('--password', '-p'),
help='The password used to log into a container registry')

register_cli_argument('acr', 'registry_url',
options_list=('--registry-url', '-u'),
help='The login server of the container registry')

register_cli_argument('acr create', 'registry_name', completer=None,
validator=validate_registry_name)
register_cli_argument('acr create', 'resource_group_name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from json import loads
import requests

from azure.cli.core._profile import Profile
from azure.cli.core._util import CLIError
from azure.cli.core.commands.parameters import get_resources_in_subscription
from azure.cli.core._profile import Profile

from ._constants import (
ACR_RESOURCE_PROVIDER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
get_resource_group_name_by_registry_name,
arm_deploy_template,
random_storage_account_name,
docker_login_to_registry
docker_login_to_registry,
get_registry_by_name
)

import azure.cli.core._logging as _logging
Expand Down Expand Up @@ -116,12 +117,6 @@ def acr_show(registry_name, resource_group_name=None):

return client.get_properties(resource_group_name, registry_name)

def acr_login(registry_url):
'''Login to a container registry through Docker.
:param str registry_url: The url of container registry
'''
docker_login_to_registry(registry_url)

def acr_update_get(client,
registry_name,
resource_group_name=None):
Expand Down Expand Up @@ -165,3 +160,11 @@ def acr_update_set(client,
resource_group_name = get_resource_group_name_by_registry_name(registry_name)

return client.update(resource_group_name, registry_name, parameters)

def acr_login(registry_name):
'''Login to a container registry through Docker.
:param str registry_name: The name of container registry
'''
registry, _ = get_registry_by_name(registry_name)
login_server = registry.login_server #pylint: disable=no-member
docker_login_to_registry(login_server)