I'm looking for a way to get Azure ACR access token using golang sdk. Similar to the result of the following console commands:
az login --service-principal -u <app-id> -p <password-or-cert> --tenant <tenant>
az acr login --name <registry id> --expose-token --only-show-errors
Here is my solution. Just set
tenantId
andacrService
and run it. The output will give you user and password (token) to use in a docker login command. Please note: User is literally "00000000-0000-0000-0000-000000000000". Don't replace that.Then, just log into the registry: