I am following this tutorial showing how to develop IoT Edge modules with Linux containers.
I have created an Azure registry (I will call it myazureregistry
).
Now I am trying to "docker push" the example module to this registry:
sudo docker push myazureregistry.azurecr.io/filtermodule:0.0.1-amd64
Alas, when running this command, I run into the following error:
unauthorized: authentication required, visit
https://aka.ms/acr/authorization for more information.
I have checked the webpage. It states that:
The ability to docker push an image […] requires authentication
with the registry using the authorized identity.
But I have already successfully logged in using sudo az acr login --name myazureregistry
What am I missing here?
EDIT [09/04/2023]:
I checked the permissions listed here. My contributor role should allow me to push images.
2
Answers
I’ve come across that error message many times when using a new service principal or even entirely new account and forgot to that user which I’m using to run the shell (where you used your sudo az acr login – command) a ACR specific role like "acr push" (which also allows for pulling images).
I haven’t personally used the admin user on the ACR like you do here, but you would have to be using that identity in your command line tool to have access via that admin account.
If you can do role assignements in the Azure AD linked to your subscription, try assigning a acr role like the one named above and do your workflow again. Hope it helps figuring out what identity is actually making the request to the ACR.
Did the command
az acr login --name myazureregistry
prompt for any password when you tried to execute it? If theaz acr login command
does not prompt for any credentials, it means that you are already authenticated to Azure using the Azure CLI. In this case, the command uses the existing authentication context to log you in to the specified Azure Container Registry (ACR) instance. It could be possible that user logged in does not have the desired permissions to push the image to the Azure container registry.To resolve this, execute the following command before you login to the container registry.
You can get the credentials from the Azure portal by navigating to the Azure container registry and Access keys section. Refer the below image.