DEV Community

Cover image for Error Logging in to Azure Container Registry : Requested access to the resource is denied
Malek
Malek

Posted on • Updated on

Error Logging in to Azure Container Registry : Requested access to the resource is denied

steps of pushing Docker image to Azure Container Registry

Following up the documentation, the first steps that I went through are displayed below :

  1. Sign in to Azure
  2. Create a container registry
  3. Log in to the registry
  4. Push image to the registry
  5. List container images
  6. Run image from the registry
  7. Clean up resources

At the third step, following the instructions of the documentation as shown below, it specifies the rule as following " (Specify only the registry name when logging in with the Azure CLI. Don't include the 'azurecr.io' suffix.) "

documentation screenshot

That instruction may have worked for some developers, but it cost me half a day logging in and out of azure, restarting docker, and trying all kinds of tips and tricks.

What went wrong ?

"Denied : Requested access to the resource is denied", such an error may delay your production plans if not treated wisely. Trying to test some functionalities on azure container registry (ACR), I created a basic docker image, and followed the official documentation of Microsoft in order to push it into the registry ( already created). Do you think everything worked like charm, Nah! If it did, you won't be reading this article ;) Instead, I got this disturbing error :

Alt Text

How I fixed this ?

The solution was to use the whole registry name including the azurecr.io, contrary to what's specified in the documentation. The commands that worked for me are specified below :

  • docker login yourregistry.azurecr.io

    After running this command, you will need to enter your container registry username and password, you will find them on the Access keys tab under settings section of the container registry home page.

  • docker image tag imagename:[version] registryname.azurecr.io/imagename:[version]
  • docker push registryname.azurecr.io/imagename:[version]

After using those commands, I was able to push my images to the Azure container registry, but still don't know why Microsoft does specify that rule in the documentation, and whether it worked for some developers ( without adding the ".azurecr.io" ).

Update

Continuing my learning journey with Azure Container Registry , I found out that the documentation written on 2019 and not updated on the first months of 2020 ( the documentation mentioned above is updated on first months of 2020) , is using the full version of the Azure Registry Container ( RegistryName.azurecr.io ) , so may be this error is related to the version of CLI , am not sure , but I will continue ivestigating this issue whenever I have time. Meanwhile , keep coding and conquer the bugs

More information on the next articles will be provided about the task I was working on when I ran into this issue. If you are using the Azure Container Registry , you may have a comment about the solution or the documentation , please leave it below , and Thanks for reading so far , I hope you learned something new and that this fix works for you.

Top comments (0)