1
votes

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?

3
Encountering the same problem, I registered a bug at Microsoft developercommunity.visualstudio.com/content/problem/444576/…Ulrik
There is also a GitHub issue for this github.com/AzureCR/azure-cli/issues/302. This is a behavior change in the az cli that requires a login.Chris Patterson

3 Answers

3
votes

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'
1
votes

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)
0
votes

Update to @Andy answer since this command is no longer valid.

When working with Azure DevOps Hosted agents, Some software is installed on the machine automatically. The full list can be found here Ubuntu.

One of the Softwares is Azure CLI:Latest. Therefore, in case you want to downgrade you need to install a new version.The following command is how i managed to install new version (Bash):

sudo apt install -y --allow-downgrades azure-cli=%AZ VERSION%-1~bionic

Usage:

sudo apt install -y --allow-downgrades azure-cli=2.2.0-1~bionic

What does the trick is to use ~bionic after specifying the version you want to install.