runner-images icon indicating copy to clipboard operation
runner-images copied to clipboard

az-cli cannot pin a version

Open boldandbusted opened this issue 6 months ago • 8 comments

Description

Hello. I'd like to be able to specify the specific version of the Azure CLI to be installed on a runner. Looking at the build scripts, it seems like only the "latest" will be installed. Thank you!

Platforms affected

  • [ ] Azure DevOps
  • [x] GitHub Actions - Standard Runners
  • [x] GitHub Actions - Larger Runners

Runner images affected

  • [x] Ubuntu 22.04
  • [x] Ubuntu 24.04
  • [ ] macOS 13
  • [ ] macOS 13 Arm64
  • [ ] macOS 14
  • [ ] macOS 14 Arm64
  • [ ] macOS 15
  • [ ] macOS 15 Arm64
  • [ ] Windows Server 2019
  • [ ] Windows Server 2022
  • [ ] Windows Server 2025

Image version and build link

Any current Ubuntu version. Perhaps the MacOS ones as well, but I'm unable to validate that.

Is it regression?

No

Expected behavior

I may use a variable to set the version of the Azure CLI. Especially useful when a bug in the Azure CLI causes other actions to fail with obscure errors. :)

Actual behavior

I cannot set a value, and must install only the 'latest' version of the Azure CLI.

Repro steps

  1. Execute actions on a Runner.
  2. Note the version of az-cli is only the latest.
  3. Cry.

Thank you in advance!

boldandbusted avatar Jun 10 '25 16:06 boldandbusted

@boldandbusted Thank you for bringing this issue to our attention. We will look into this issue and will update you after investigating.

RaviAkshintala avatar Jun 10 '25 17:06 RaviAkshintala

The 2.74.0 (latest) version of Azure CLI also introduces this issue: https://github.com/Azure/azure-cli/issues/31591. The warning UserWarning: pkg_resources is deprecated as an API is incorrectly treated as a terminating error in Azure DevOps pipelines.

The issue has been resolved in version 2.75.0, but that will not be released until the 1st of July.

Is it possible to temporarily pin the version to 2.73.0?

Drenth1 avatar Jun 12 '25 06:06 Drenth1

@Drenth1 We'll review it and get back to you shortly. Thanks.

RaviAkshintala avatar Jun 12 '25 07:06 RaviAkshintala

seconded. need the ability to pin versions as this has broken a lot of pipelines at my organization alone.

original issue thread over there has a bunch of comments about this issue. The Microsoft Hosted agents seem to slowly be rolling out to all MSFT hosted agents as this morning it was ~50/50 chance of pipeline failure on the hosted agents. I imagine support is probably fielding a bunch of issues right now about people's builds failing

fostermarcp avatar Jun 13 '25 21:06 fostermarcp

@boldandbusted could you please try the following script and see if this helps to install older version of az cli.

apt-cache policy azure-cli AZ_DIST=$(lsb_release -cs) AZ_VER=2.73.0 sudo apt-get install azure-cli=${AZ_VER}-1~${AZ_DIST} --allow-downgrades

sriniknms avatar Jun 16 '25 16:06 sriniknms

@sriniknms The pip installation method works for me and my present use-case as a workaround. I'm sure using apt should work fine for the workaround as well. :)

It would be great if the Runner image build process used apt to install the Azure CLI in the first place, so we don't make a mess of the installation just to downgrade it or pin a version. We don't want core components installed outside of package management if it can be avoided.

boldandbusted avatar Jun 16 '25 17:06 boldandbusted

@Drenth1 Can you please follow the steps below to downgrade to the required version. Thank you.

1. sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

2. sudo mkdir -p /etc/apt/keyrings
curl -sLS https://packages.microsoft.com/keys/microsoft.asc |
  gpg --dearmor | sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null
sudo chmod go+r /etc/apt/keyrings/microsoft.gpg

3. AZ_DIST=$(lsb_release -cs)
echo "Types: deb
URIs: https://packages.microsoft.com/repos/azure-cli/
Suites: ${AZ_DIST}
Components: main
Architectures: $(dpkg --print-architecture)
Signed-by: /etc/apt/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/azure-cli.sources

4. sudo apt-get update
sudo apt-get install azure-cli

5. apt-cache policy azure-cli

6. # Obtain the currently installed distribution
AZ_DIST=$(lsb_release -cs)

# Store an Azure CLI version of choice
AZ_VER=2.73.0


# Install a specific version
sudo apt-get install azure-cli=${AZ_VER}-1~${AZ_DIST}

RaviAkshintala avatar Jun 17 '25 07:06 RaviAkshintala

@RaviAkshintala , this will likely work, but it is not the preferred solution. It would mean that all teams in our organization would have to add this task to their pipeline to downgrade the Azure CLI version. We have instead opted for pausing our internal release process until the fixed version of the Azure CLI is released.

Drenth1 avatar Jun 19 '25 07:06 Drenth1

Hi All, The new version of Azure CLI 2.75.0 will be available in the next image rollout. We are closing this issue now. Thank you.

RaviAkshintala avatar Jul 02 '25 10:07 RaviAkshintala

Hi there. We still have a need to be able to select the az cli version. The original bugs which influenced this still exist in the latest versions of az-cli.

Ref: https://github.com/Azure/azure-cli/issues/31581

Thanks.

boldandbusted avatar Aug 21 '25 20:08 boldandbusted