Az - ACR

支持 HackTricks

基本信息

Azure Container Registry (ACR) 是由 Microsoft Azure 提供的托管服务,用于存储和管理 Docker 容器映像和其他工件。它提供集成的开发人员工具、地理复制、诸如基于角色的访问控制和映像扫描等安全功能、自动构建、Webhooks 和触发器以及网络隔离。它与 Docker CLI 和 Kubernetes 等流行工具配合使用,并与其他 Azure 服务很好地集成。

枚举

要枚举该服务,您可以使用脚本 Get-AzACR.ps1:

# List Docker images inside the registry
IEX (New-Object Net.Webclient).downloadstring("https://raw.githubusercontent.com/NetSPI/MicroBurst/master/Misc/Get-AzACR.ps1")

Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name "DisableFirstRunCustomize" -Value 2

Get-AzACR -username <username> -password <password> -registry <corp-name>.azurecr.io

Azure Container Registry (ACR)

List all ACRs in a subscription

To list all Azure Container Registries (ACRs) in a subscription, use the following command:

az acr list --subscription <subscription_id>

Replace <subscription_id> with the ID of the subscription you want to list the ACRs for.

Show details of a specific ACR

To show details of a specific Azure Container Registry (ACR), use the following command:

az acr show --name <acr_name> --resource-group <resource_group_name>

Replace <acr_name> with the name of the ACR you want to show details for, and <resource_group_name> with the name of the resource group the ACR belongs to.

Delete an ACR

To delete an Azure Container Registry (ACR), use the following command:

az acr delete --name <acr_name> --resource-group <resource_group_name>

Replace <acr_name> with the name of the ACR you want to delete, and <resource_group_name> with the name of the resource group the ACR belongs to.

az acr list --output table
az acr show --name MyRegistry --resource-group MyResourceGroup

Az Powershell

Azure CLI is a command-line tool that provides a set of commands used to manage Azure resources. Azure CLI is available on Windows, macOS, and Linux. Azure CLI commands can be executed in the Azure Cloud Shell or in a local installation of Azure CLI.

Installation

To install Azure CLI on Windows, you can download and run the MSI installer from the Azure CLI website. On macOS, you can use Homebrew by running brew update && brew install azure-cli. On Linux, you can use the package manager of your distribution to install Azure CLI.

Authentication

Azure CLI supports several authentication methods, including Azure Active Directory (AD), service principals, and managed identities. You can log in to Azure CLI using the az login command and follow the instructions to authenticate.

Example Commands

Here are some example Azure CLI commands:

  • az login: Log in to Azure CLI.

  • az group list: List all resource groups in the subscription.

  • az vm create --resource-group MyResourceGroup --name MyVM --image UbuntuLTS: Create a virtual machine.

Scripting

You can also write scripts using Azure CLI commands to automate tasks suchjson as resource provisioning, configuration management, and monitoring.

# List all ACRs in your subscription
Get-AzContainerRegistry

# Get a specific ACR
Get-AzContainerRegistry -ResourceGroupName "MyResourceGroup" -Name "MyRegistry"

登录并从注册表中拉取

docker login <corp-name>.azurecr.io --username <username> --password <password>
docker pull <corp-name>.azurecr.io/<image>:<tag>
支持 HackTricks

Last updated