azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

pipelines variable-group Not working with AzureCLI@2 Task

Open JFolberth opened this issue 3 years ago • 5 comments

Trying to have a MS hosted DevOps agent query a Team project to select predefined variable groups. This works locally however; when coupled with the Azure CLI Task Get an error Before you can run Azure DevOps commands, you need to run the login command(az login if using AAD/MSA identity else az devops login if using PAT token) to setup credentials. Please see https://aka.ms/azure-devops-cli-auth for more information.

Try logging in via a PAT and script before this step and still not able to successfully run the az pipelines command


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

JFolberth avatar Jan 26 '21 14:01 JFolberth

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @narula0781, @ashishonce, @romil07.

Issue Details

Trying to have a MS hosted DevOps agent query a Team project to select predefined variable groups. This works locally however; when coupled with the Azure CLI Task Get an error Before you can run Azure DevOps commands, you need to run the login command(az login if using AAD/MSA identity else az devops login if using PAT token) to setup credentials. Please see https://aka.ms/azure-devops-cli-auth for more information.

Try logging in via a PAT and script before this step and still not able to successfully run the az pipelines command


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Author: JFolberth
Assignees: -
Labels:

DevOps, Pipelines, Service Attention

Milestone: -

ghost avatar Jan 26 '21 15:01 ghost

pipelines

yonzhan avatar Jan 26 '21 15:01 yonzhan

Any update on this?

JFolberth avatar Feb 01 '21 14:02 JFolberth

devops service team should look into this issue.

yonzhan avatar Feb 01 '21 14:02 yonzhan

Following should work without needing to do azure login:

      - task: Bash@3
        displayName: "Build .env"
        inputs:
          targetType: 'inline'
          script: |
            #!/bin/bash
            az extension add -n azure-devops
            az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project="$(System.TeamProject)" --use-git-aliases true

            az pipelines variable-group list --output table
        env:
          AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)

neoswallow avatar Apr 26 '22 17:04 neoswallow