question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az acr login failure

See original GitHub issue

Attempting to log in to a Container Registry server gives me a “stub received bad data” error. (Same thing happens running PowerShell in admin mode.)

PS> az acr login --name contregdmsmith
Error saving credentials: error storing credentials - err: exit status 1, out: `The stub received bad data.
### Environment summary

Install Method: MSI
CLI version: azure-cli (2.0.20)
OS version: Windows 10 (1703 // 15063.674)
Shell Type: Powershell  

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
yugangw-msftcommented, Nov 8, 2017

This is a known issue, see below for the workaround that @djyou provided through a recent email exchange

“acr login” uses AAD and docker in Windows uses wincred to save ACR refresh token by default. The token can sometimes exceed 4K in length (e.g., due to customized roles) which will get truncated. You didn’t see it when credential is specified because username/password pair is much shorter.

One quick workaround is to modify <User folder>\.docker\config.json file. Remove the following line so docker will use file system to store tokens:

               "credsStore": "wincred"

We are also rolling out a fix in the token server that will limit the token length.

7reactions
sajayantonycommented, Nov 14, 2017

@jblackburn21 - the Credential helper is something that is being worked on and not yet released. @shhsu is working on release it officially since this solves the credential renew issue. The main issue is that the token is larger than what windows credential store can handle and hence failing. The workaround that @djyou suggested is something that can unblock you and will create a config file that will use the default file credential store instead of the windows credential store.

'{"auths": {"contregdmsmith.azurecr.io": {}}}' | Set-Content $HOME/.docker/config.json
az acr login -n contregdmsmith

I think we can consider fixing the CLI to prompt setting the credential store automatically as a fix to this bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot login to registry - Azure Container Registry
az acr login succeeds but docker fails with error: unauthorized: authentication required. Confirm credentials to access registry. Check the ...
Read more >
az acr login failed · Issue #23987 · Azure/azure-cli
We find that az acr login could work if we create a symbol link of docker.exe at current dir. Formerly it also works...
Read more >
Azure Application not registered with AAD
I had this error unauthorized: Application not registered with AAD when during ... az acr login --name <your-repo-name-here>.azurecr.io.
Read more >
Unable To Get AAD Authorization Token With Message
When you are trying to authenticate with Azure container registry using sudo az acr login command, you may receive below error message:.
Read more >
Authenticating using Azure Container Registry
The CLI uses the token produced when you did az login to easily authenticate your session with your registry once you log in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found