Azure / docker-login

GitHub action to log in to Azure Container Registry (ACR) or any private container registry
MIT License
109 stars 48 forks source link

Allow login using service credentials dirctly #54

Open JoeMarkov opened 1 year ago

JoeMarkov commented 1 year ago

As described here: https://github.com/Azure/docker-login/issues/23

I can login to Azure ACR using the service principal id and key

- uses: azure/docker-login@v1
  with:
    login-server: contoso.azurecr.io
    username: ${{ secrets.REGISTRY_USERNAME }}
    password: ${{ secrets.REGISTRY_PASSWORD }}
Where you can set the REGISTRY_USERNAME as your service principal id and REGISTRY_PASSWORD as your service principal key.

Great!

but, then I need to pass two additional secrets to my github actions. And I want to reduce it down to just having to provide my entire credentials json blog, and the login action could extract the id and key from it.

so, basically, I would like the action to look something like this:

- uses: azure/docker-login@v1
  with:
    login-server: contoso.azurecr.io
    credentials: ${{ secrets.Azure_ServicePrincipal_Credentials }}

By supporting this, I would just have to pass one secret (my SP credentials) to github action secrets and then I can both push to my registry and for example deploy new Azure Container Instances.

lgmorand commented 3 months ago

I do agree. it could a nice option. feel free to do a PR to bring it