Docker Push to Azure Container Registry always fails on authentication regardless

David Hirst 20 Reputation points
2025-07-03T14:16:27.15+00:00

I am trying to push an image from docker to an ACR.

Regardless of what I try, I am constantly told that the request is unauthenticated, despite being given successful login messages when I authenticate prior to making the push.

I have tried the following:

az login
az acr login --name myacrname

docker tag localImageName:<Tag> myacrname.azurecr.io/localImageName:<Tag>
docker push myacrname.azurecr.io/localImageName:<Tag>	

It throws the following:

unauthorized: {"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 31ee7a50-xxxx-xxxx-xxxx-c1a7a530e786"}]}

I have tried this:

docker login -u acradmin -p acradminpassword myacrname
az login
az acr login --name myacrname -u acradmin -p acradminpassword

docker tag localImageName:<Tag> myacrname.azurecr.io/localImageName:<Tag>
docker push myacrname.azurecr.io/localImageName:<Tag>	

I get the same error. I can confirm that my own user (that opens the CLI) has owner, acrpush and acrpull roles on the ACR and if I run an az acr repository command I get results back and if I do a docker pull it also works.

I have ran acr healh-check and it comes back clean. Nothing seems to work and all I seem to get is this message. What is wrong here?

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
{count} votes

3 answers

Sort by: Most helpful
  1. Nikhil Duserla 8,515 Reputation points Microsoft External Staff Moderator
    2025-07-03T16:24:47.02+00:00

    Hello @David Hirst,
    It appears you're encountering an authentication issue while attempting to push an image to Azure Container Registry (ACR). Still having Owner role to the Container Registry to push and pull images you have to enable the admin user. This generates a username, password, and password2.

    Once enabled the admin user try log in now to Azure Container Registry using the command:

    az acr login --name my-container-registry
    

    Tag your docker image:

    docker tag image-name:image-tag my-container-registry.azurecr.io/image-name:image-tag
    

    And now push image to Azure Container Registry using the command:

    docker push my-container-registry.azurecr.io/image-name:image-tag
    

    Remove the docker login step from your build, docker tasks handle auth for you using azure subscription endpoint (if it is properly configured), if not - give your service principal permissions to acrpush).

    Additionally, case sensitivity may lead to issues. When using its server url in docker commands, to avoid authentication errors, use all lowercase.

    If you have any further queries, do let us know.

    0 comments No comments

  2. Nikhil Duserla 8,515 Reputation points Microsoft External Staff Moderator
    2025-07-08T07:36:52.9+00:00

    Hello @David Hirst,

    Could you please share a screenshot of the issue via private message?

    In the meantime, I’ve tested the same scenario in my lab environment and was able to successfully push a Docker image to Azure Container Registry (ACR). Please follow the steps below to ensure everything is set up correctly:

    Create an Azure Container Registry (ACR) via the Azure portal.

    Install Docker on your local machine if it’s not already installed.

    1. Log in to ACR from the command line using:
         
         docker login <your-login-server>.azurecr.io
      
      (Replace <your-login-server> with your actual ACR login server, e.g., mysetup.azurecr.io.)
    2. Pull the hello-world image:
         docker pull hello-world
      
    3. Tag the image for your ACR:
         
         docker tag hello-world:latest mysetup.azurecr.io/samples/hello-world:latest
      
    4. Push the image to ACR:
         
         docker push mysetup.azurecr.io/samples/hello-world
      

    User's image

    Additionally, having below role assignments is required-

    -> ACR Pull permissions are needed for login

    -> ACR Push permissions are needed to push

    -> After giving ACR Push permissions , try to re-login again

    -> Wait for couple of mins to completely propagate the permissions

    Let me know if you encounter any issues during these steps.

    0 comments No comments

  3. David Hirst 20 Reputation points
    2025-07-11T15:23:03.5933333+00:00

    The above is not really an accepted answer, whilst the above instructions may work when you are using a new ACR they do not work, or I should did not work with the existing ACR we were trying to utilize. Regardless of which user account was used it simply throws this same authentication error each time a push is made. To me this is indicative a problem or bug with the container registry software used by Microsoft itself as a search online for a solution shows, as I am not the only person on the internet who seems to experience this issue with Azure.

    To resolve our immediate problem we have had no choice but create a new ACR, copy the images from the old one to the new one and then to delete the original.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.