az login fails wih Azure DevOps Pipelines

2019-08-04 11:16发布

问题:

Since Today all our build pipelines on Azure Devops fail, when trying to execute the follwoing command:

az acr helm push ...

The pipeline fails with following error:

ERROR: Please run 'az login' to setup account.

We are running on Microsoft hosted agents using Hosted Ubuntu 1604.
Checking the latest commits for the Ubuntu image shows, that there has been a version update from 2.0.52 to 2.0.55 of the azure cli tool.

https://github.com/Microsoft/azure-pipelines-image-generation/commit/56c54c965019c4f7456cd9af572a443df9d5d78c#diff-f87405c9dd43f633a04dd078666d61af

Maybe this version update introduced the problem. Just guessing.

Can anyone help please?

回答1:

I added the following to my pipeline to downgrade azure-cli a version, and my pipeline is now passing

- bash: sudo apt-get install -y --allow-downgrades azure-cli=2.0.54-1~xenial
  displayName: 'downgrade azure-cli'


回答2:

The issue has been raised with the azure-cli tool team.

To proceed now you can follow any of the two workarounds as of now:

  • Use Az CLI task instead of Bash script to run az commands.
  • Use Hosted VS2017 agent to run az commands because this agent has 2.0.52 version of az-cli tool which runs this command successfully (as against Hosted Ubuntu 1604 which has az-cli v2.0.55)