cli: azure/cli@v1 not working with azure/login@v1 on self-hosted runner


I’m running self hosted runners on k8s using, which doesn’t have az cli installed by default.

So in my workflow, I’m installing it using curl -sL | sudo bash as per MS’s documentation and signing in using azure/login@v1 and a service account which works fine, but when I’m running azure/cli@v1 right after, it gives the following errors:

ERROR: Please run 'az login' to setup account.
Error: Error: az cli script failed.


here is how the github job looks:

    runs-on: self-hosted
      - uses: actions/checkout@v2

      - name: Install az cli
        run: curl -sL | sudo bash

      - uses: azure/login@v1
        name: Sign in to Azure
          creds: ${{ secrets.AZURE_CREDENTIALS }}
          environment: azurecloud

      - uses: azure/cli@v1
        name: Run what-if
          inlineScript: |
            az deployment sub what-if --location ${{ env.RESOURCEGROUP_LOCATION }} \
              --template-file deploy/main.bicep

Any idea how to fix this?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

We have this issue, too. Workaround is to install az cli in the runner image or in the runner at runtime and call it from bash, as @damian-archlet suggested.

Would like to have this fixed, though.

Have the exact same issue. My workaround was to just use the azure/login@v1 action to login and then a bash step to run the rest of my pipeline. Would be nice to have it working though.