# Prerequisite
# 1) Install azure-cli, curl
# 2) Grant the identity AcrPull role on the registry
az login --identity
registry="myregistry.azurecr.io"
aad_access_token=$(az account get-access-token --resource=https://containerregistry.azure.net)
tenant=$(az account show --query tenantId -o tsv)
acr_username="00000000-0000-0000-0000-000000000000"
acr_refresh_token=$(curl -v -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=access_token&service=$registry&tenant=$tenant&access_token=$aad_access_token" https://$registry/oauth2/exchange)
docker login -u $acr_username -p "$acr_refresh_token" $registry
Last active
February 25, 2025 05:39
-
-
Save northtyphoon/d76f57a0fe58ce1d38800529a62ca36b to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment