azuredockerazure-container-registry

Docker login to Azure Container Registry by Service Principle


I've created a service principle with AcrPush role assigned. But when I access the container registry from docker it ask me user name and password. I've never set the user name and password, how can I configure the docker to user the service principle?


Solution

  • You do not have to set the username and password as it is already there in the container registry. In the container registry, you can enable the admin mode, and that is where you get your credentials from. enter image description here

    docker login myregistry.azurecr.io

    Enter the username and password from the portal and it should work.

    With service principal if properly created, you can do the following:

    docker login myregistry.azurecr.io --username $SP_APP_ID --password $SP_PASSWD