Giter Club home page Giter Club logo

Comments (3)

maxheld83 avatar maxheld83 commented on September 16, 2024 9

Agreed it'd be nice if the docker-login action supported OIDC somehow out of the box.

In the meantime, I just used the az CLI to leverage my OIDC setup:

      - name: 'Az CLI login'
        uses: azure/login@v1
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID_GITHUB_AUTH }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      - name: Login to ACR via OIDC
        run: az acr login --name <registry-name>

from docker-login.

itpropro avatar itpropro commented on September 16, 2024

Any progress on this? OIDC is the security best practice to authenticate against Azure and it's still not supported.
It would already be enough if this action would support token based authentication (https://learn.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli#az-acr-login-with---expose-token) against the ACR, as the Azure CLI action already supports OIDC:

      - name: Get ACR credentials
        id: get-acr-credentials
        uses: azure/CLI@v1
        with:
          azcliversion: latest
          inlineScript: |
            echo "ACR_ACCESS_TOKEN=$(az acr login --name <ACRNAME> --expose-token --output tsv --query accessToken)" >> "$GITHUB_OUTPUT"
            echo "ACR_LOGIN_SERVER=$(az acr login --name <ACRNAME> --expose-token --output tsv --query loginServer)" >> "$GITHUB_OUTPUT"

      - name: Login to ACR
        uses: docker/login-action@v3
        with:
          registry: ${{ steps.get-acr-credentials.outputs.ACR_LOGIN_SERVER }}
          username: 00000000-0000-0000-0000-000000000000
          password: ${{ steps.get-acr-credentials.outputs.ACR_ACCESS_TOKEN }}

The current workaround without using the login-action is this:

      - name: Log in to Azure
        uses: azure/login@v1
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

      - name: Login to Azure Container Registry
        run: az acr login --name $ACR_NAME
        env:
          ACR_NAME: ${{ vars.ACR_NAME }}

from docker-login.

sonnysideup avatar sonnysideup commented on September 16, 2024

I agree with @itpropro. It seems a bit injudicous to enhance security with an OIDC mechanism but then lack a way to leverage those credentials for ACR, right?

In other words, az acr login --name <name> will create the necessary docker credentials, but those credentials will never be destroyed unless you do it manually at the end of your job. docker/login-action does the right thing by adding a post job hook to call docker logout, so why can't the azure/login be extended to perform some steps similar to the ones listed in #56 (comment)?

from docker-login.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.