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 f2151eaf10f..04a69b185da 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_help.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_help.py @@ -1175,6 +1175,16 @@ short-summary: Delete a private endpoint connection request for a container registry long-summary: To create a private endpoint connection use "az network private-endpoint create". For more information see https://aka.ms/acr/private-link """ + +helps['acr private-link-resource'] = """ +type: group +short-summary: Manage registry private link resources. +""" + +helps['acr private-link-resource list'] = """ +type: command +short-summary: list the private link resources supported for a registry +""" # endregion # region encryption diff --git a/src/azure-cli/azure/cli/command_modules/acr/commands.py b/src/azure-cli/azure/cli/command_modules/acr/commands.py index 6c3326f0f41..7f8402ac992 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/commands.py +++ b/src/azure-cli/azure/cli/command_modules/acr/commands.py @@ -307,6 +307,9 @@ def load_command_table(self, _): # pylint: disable=too-many-statements g.command('approve', 'approve') g.command('reject', 'reject') + with self.command_group('acr private-link-resource', acr_custom_util, is_preview=True) as g: + g.command('list', 'list_private_link_resources') + with self.command_group('acr identity', acr_custom_util, is_preview=True) as g: g.command('show', 'show_identity') g.command('assign', 'assign_identity') 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 97f55b7a669..04ccfd78bfd 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/custom.py +++ b/src/azure-cli/azure/cli/command_modules/acr/custom.py @@ -493,3 +493,8 @@ def _resolve_identity_client_id(cli_ctx, managed_identity_resource_id): res = parse_resource_id(managed_identity_resource_id) client = get_mgmt_service_client(cli_ctx, ManagedServiceIdentityClient, subscription_id=res['subscription']) return client.user_assigned_identities.get(res['resource_group'], res['name']).client_id + + +def list_private_link_resources(cmd, client, registry_name, resource_group_name=None): + resource_group_name = get_resource_group_name_by_registry_name(cmd.cli_ctx, registry_name, resource_group_name) + return client.list_private_link_resources(resource_group_name, registry_name)