Skip to content
This repository was archived by the owner on Sep 29, 2020. It is now read-only.
This repository was archived by the owner on Sep 29, 2020. It is now read-only.

ACR Auto-login not working in some scenario #29

Closed
@gtardif

Description

@gtardif

ACR Auto-login has been implemented following this doc that describes how to exchange the Azure mgmt token into a token that ACR accepts: https://github.com/Azure/acr/blob/master/docs/AAD-OAuth.md#getting-credentials-programatically.

Some users at Microsoft are seeing errors while trying to deploy ACR images:
@BigMorty:

Not working for me, here is what I did and the error I received...

C:\Users\mikemort\source\repos\OrderProc>docker logout mikemortacr.azurecr.io
Removing login credentials for mikemortacr.azurecr.io

C:\Users\mikemort\source\repos\OrderProc>docker logout azure
Removing login credentials for Azure

C:\Users\mikemort\source\repos\OrderProc>docker login azure
login succeeded

C:\Users\mikemort\source\repos\OrderProc>docker context use MyACI
MyACI

C:\Users\mikemort\source\repos\OrderProc>docker run -d mikemortacr.azurecr.io/myexpressapp:2.2
Could not automatically login to mikemortacr.azurecr.io from your Azure login. Assuming you already logged in to the ACR > registry
[+] Running 0/1

Group goofy-rhodes Waiting 3.0s
containerinstance.ContainerGroupsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InaccessibleImage" Message="The image 'mikemortacr.azurecr.io/myexpressapp:2.2' in container group 'goofy-rhodes' is not accessible. Please check the image and registry credential."
C:\Users\mikemort\source\repos\OrderProc>

@gtardif :

To help debugging this, could you try to manually run the call to obtain the ACR token (as described here), I assume in your context it will fail, the error message might help.

registry="contosoregistry.azurecr.io"
tenant="409520d4-8100-4d1d-ad47-72432ddcc120"
aad_access_token="eyJ...H-g"
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

You can get the values for tenant & access token from ~/.azure/dockerAccessToken.json

@BigMorty:

Here is the error I received - {"errors":[{"code":"UNAUTHORIZED","message":"retrieving permissions failed"}]}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions