Skip to content

[REGRESSION]: AzureCLI@2 task gives [Error]Can't parse az version from: #21512

@ryan-altitudeit

Description

@ryan-altitudeit

New issue checklist

Task name

AzureCLI@2

Breaking task version

2.262.1

Last working task version

2.262.1

Regression Description

A build running on 2025-11-10 (no issues) and then again on 2025-11-11 which resulted in the following error being output from the AzureCLI task. The task version between the two runs remains the same - 2.262.1

It appears the default behavior has changed from running:
"az --version" to "az version" which it can't parse the version correctly.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Ubuntu 22.04

Relevant log output

##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]/usr/bin/az arg: version
##[debug]/usr/bin/az arg: version
##[debug]exec tool: /usr/bin/az
##[debug]exec tool: /usr/bin/az
##[debug]arguments:
##[debug]arguments:
##[debug]   version
##[debug]   version
/usr/bin/az version
##[debug]Agent environment resources - Disk: / Available 21934.11 MB out of 29588.06 MB, Memory: Used 896.00 MB out of 15995.00 MB, CPU: Usage 25.30%
##[debug]Agent environment resources - Disk: / Available 21934.07 MB out of 29588.06 MB, Memory: Used 904.00 MB out of 15995.00 MB, CPU: Usage 25.30%
##[debug]Feature 'UseAzVersion' = 'True'. Processed as 'true'.
##[error]Can't parse az version from: 
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=fa9bfa51-700c-4daf-ba8f-405e1368e0a8;]Can't parse az version from: 
##[debug]Feature 'ShowWarningOnOlderAzureModules' = 'False'. Processed as 'false'.
##[debug]useGlobalConfig=false

Full task logs with system.debug enabled

UNSUCCESSFUL RUN
##[debug]Evaluating condition for step: 'Initialize Terraform configuration'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
Starting: Initialize Terraform configuration
==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version      : 2.262.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
##[debug]Using node path: /agent/externals/node20_1/bin/node
##[debug]system.debug=True
##[debug]DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff=True
##[debug]agent.TempDirectory=/agent/_work/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_CONNECTEDSERVICENAMEARM
##[debug]loading INPUT_SCRIPTTYPE
##[debug]loading INPUT_SCRIPTLOCATION
##[debug]loading INPUT_SCRIPTPATH
##[debug]loading INPUT_INLINESCRIPT
##[debug]loading INPUT_POWERSHELLERRORACTIONPREFERENCE
##[debug]loading INPUT_ADDSPNTOENVIRONMENT
##[debug]loading INPUT_USEGLOBALCONFIG
##[debug]loading INPUT_CWD
##[debug]loading INPUT_FAILONSTANDARDERROR
##[debug]loading INPUT_POWERSHELLIGNORELASTEXITCODE
##[debug]loading INPUT_VISIBLEAZLOGIN
##[debug]loading INPUT_KEEPAZSESSIONACTIVE
##[debug]loading ENDPOINT_AUTH_
##[debug]loading ENDPOINT_AUTH_SCHEME_
##[debug]loading ENDPOINT_AUTH_PARAMETER__SERVICEPRINCIPALID
##[debug]loading ENDPOINT_AUTH_PARAMETER__TENANTID
##[debug]loading ENDPOINT_AUTH_PARAMETER__WORKLOADIDENTITYFEDERATIONISSUERTYPE
##[debug]loading ENDPOINT_AUTH_PARAMETER__WORKLOADIDENTITYFEDERATIONSUBJECT
##[debug]loading ENDPOINT_AUTH_PARAMETER__WORKLOADIDENTITYFEDERATIONISSUER
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_INFRACOSTAPIKEY
##[debug]loading SECRET_JFROG_ACCESS_TOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 26
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]check path : /agent/_work/_tasks/AzureCLI_/2.262.1/node_modules/azure-pipelines-tasks-artifacts-common/module.json
##[debug]adding resource file: /agent/_work/_tasks/AzureCLI_/2.262.1/node_modules/azure-pipelines-tasks-artifacts-common/module.json
##[debug]system.culture=en-US
##[debug]agent.proxyurl=undefined
##[debug]VSTS_ARM_REST_IGNORE_SSL_ERRORS=undefined
##[debug]AZURE_HTTP_USER_AGENT=VSTS__build_6423_0
##[debug]check path : /agent/_work/_tasks/AzureCLI_/2.262.1/node_modules/azure-pipelines-tasks-azure-arm-rest/module.json
##[debug]adding resource file: /agent/_work/_tasks/AzureCLI_/2.262.1/node_modules/azure-pipelines-tasks-azure-arm-rest/module.json
##[debug]system.culture=en-US
##[debug]Set default DNS lookup order to ipv4 first
##[debug]Set default auto select family to false
##[debug]check path : /agent/_work/_tasks/AzureCLI_/2.262.1/task.json
##[debug]adding resource file: /agent/_work/_tasks/AzureCLI_/2.262.1/task.json
##[debug]system.culture=en-US
##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]Feature flag AZP_AZURECLIV2_SETUP_PROXY_ENV not found. Returning false as default.
##[debug]scriptType=pscore
##[debug]scriptLocation=inlineScript
##[debug]scriptArguments=undefined
##[debug]powerShellErrorActionPreference=stop
##[debug]Agent.Version=4.264.2
##[debug]Agent.TempDirectory=/agent/_work/_temp
##[debug]scriptPath=/agent/_work/1/s
##[debug]inlineScript=# Retrieve TF service connection
$env:ARM_CLIENT_ID          = $env:servicePrincipalId
$env:ARM_SUBSCRIPTION_ID    = $(az account show --query id -o tsv)
$env:ARM_TENANT_ID          = $(az account show --query 'tenantId' --output tsv)
$env:ARM_OIDC_TOKEN         = $env:idToken
$env:ARM_USE_OIDC           = "true"
$env:AZURE_SUBSCRIPTION_NAME  = $(az account show --query name -o tsv)
$tfInitParams = @{
    tfRg = ""
    tfStg = ""
    tfCn = ""
    tfFile = ""
    tfValidate = $false
}
& /agent/_work/1/shared-infrastructure-scripts/deploy/terraformInit.ps1 @tfInitParams
##[debug]powerShellIgnoreLASTEXITCODE=false
##[debug]which 'pwsh'
##[debug]found: '/usr/bin/pwsh'
##[debug]which '/usr/bin/pwsh'
##[debug]found: '/usr/bin/pwsh'
##[debug]/usr/bin/pwsh arg: -NoLogo
##[debug]/usr/bin/pwsh arg: -NoProfile
##[debug]/usr/bin/pwsh arg: -NonInteractive
##[debug]/usr/bin/pwsh arg: -ExecutionPolicy
##[debug]/usr/bin/pwsh arg: Unrestricted
##[debug]/usr/bin/pwsh arg: -Command
##[debug]/usr/bin/pwsh arg: . '/agent/_work/_temp/azureclitaskscript1764626848847.ps1'
##[debug]cwd=/agent/_work/1/main-shared-infrastructure-1471049-dev
##[debug]scriptLocation=inlineScript
##[debug]failOnStandardError=false
##[debug]testing directory '/agent/_work/1/main-shared-infrastructure-1471049-dev'
##[debug]Feature 'UseAzVersion' = 'True'. Processed as 'true'.
##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]/usr/bin/az arg: version
##[debug]/usr/bin/az arg: version
##[debug]exec tool: /usr/bin/az
##[debug]exec tool: /usr/bin/az
##[debug]arguments:
##[debug]arguments:
##[debug]   version
##[debug]   version
/usr/bin/az version
##[debug]Agent environment resources - Disk: / Available 21934.11 MB out of 29588.06 MB, Memory: Used 896.00 MB out of 15995.00 MB, CPU: Usage 25.30%
##[debug]Agent environment resources - Disk: / Available 21934.07 MB out of 29588.06 MB, Memory: Used 904.00 MB out of 15995.00 MB, CPU: Usage 25.30%
##[debug]Feature 'UseAzVersion' = 'True'. Processed as 'true'.
##[error]Can't parse az version from: 
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=;]Can't parse az version from: 
##[debug]Feature 'ShowWarningOnOlderAzureModules' = 'False'. Processed as 'false'.
##[debug]useGlobalConfig=false
##[debug]Agent.TempDirectory=/agent/_work/_temp
##[debug]Agent.TempDirectory=/agent/_work/_temp
Setting AZURE_CONFIG_DIR env variable to: /agent/_work/_temp/.azclitask
##[debug]connectedServiceNameARM=
##[debug] data environment = AzureCloud
Setting active cloud to: AzureCloud
##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]/usr/bin/az arg: cloud set -n AzureCloud
##[debug]/usr/bin/az arg: cloud set -n AzureCloud
##[debug]exec tool: /usr/bin/az
##[debug]exec tool: /usr/bin/az
##[debug]arguments:
##[debug]arguments:
##[debug]   cloud
##[debug]   cloud
##[debug]   set
##[debug]   set
##[debug]   -n
##[debug]   -n
##[debug]   AzureCloud
##[debug]   AzureCloud
/usr/bin/az cloud set -n AzureCloud
##[debug]Agent environment resources - Disk: / Available 21934.11 MB out of 29588.06 MB, Memory: Used 1031.00 MB out of 15995.00 MB, CPU: Usage 25.57%
##[debug]connectedServiceNameARM=
##[debug] auth scheme = WorkloadIdentityFederation
##[debug] auth scheme = WorkloadIdentityFederation
##[debug] data SubscriptionID = 
##[debug]visibleAzLogin=true
##[debug] auth param serviceprincipalid = ***
##[debug] auth param tenantid = 
##[debug]System.JobId=
##[debug]System.PlanId=
##[debug]System.TeamProjectId=
##[debug]System.HostType=build
##[debug]System.CollectionUri=
##[debug]Getting credentials for local feeds
##[debug]SYSTEMVSSCONNECTION exists true
##[debug]Got auth token, setting it as secret so it does not print in console log
##[debug]Processed: ##vso[task.setsecret]***
##[debug]Processed: ##vso[task.setsecret]***
##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]/usr/bin/az arg: login --service-principal -u "***" --tenant "" --allow-no-subscriptions --federated-token "***
##[debug]/usr/bin/az arg: login --service-principal -u "***" --tenant "" --allow-no-subscriptions --federated-token "***
##[debug]exec tool: /usr/bin/az
##[debug]exec tool: /usr/bin/az
##[debug]arguments:
##[debug]arguments:
##[debug]   login
##[debug]   login
##[debug]   --service-principal
##[debug]   --service-principal
##[debug]   -u
##[debug]   -u
##[debug]   ***
##[debug]   ***
##[debug]   --tenant
##[debug]   --tenant
##[debug]   
##[debug]   
##[debug]   --allow-no-subscriptions
##[debug]   --allow-no-subscriptions
##[debug]   --federated-token
##[debug]   --federated-token
##[debug]   ***
##[debug]   ***
/usr/bin/az login --service-principal -u *** --tenant  --allow-no-subscriptions --federated-token ***
##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]/usr/bin/az arg: account set --subscription ""
##[debug]/usr/bin/az arg: account set --subscription ""
##[debug]exec tool: /usr/bin/az
##[debug]exec tool: /usr/bin/az
##[debug]arguments:
##[debug]arguments:
##[debug]   account
##[debug]   account
##[debug]   set
##[debug]   set
##[debug]   --subscription
##[debug]   --subscription
##[debug]   
##[debug]   
/usr/bin/az account set --subscription 
##[debug]keepAzSessionActive=false
##[debug]addSpnToEnvironment=true
##[debug]exec tool: /usr/bin/pwsh
##[debug]arguments:
##[debug]   -NoLogo
##[debug]   -NoProfile
##[debug]   -NonInteractive
##[debug]   -ExecutionPolicy
##[debug]   Unrestricted
##[debug]   -Command
##[debug]   . '/agent/_work/_temp/azureclitaskscript1764626848847.ps1'
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/agent/_work/_temp/azureclitaskscript1764626848847.ps1'

Preparing environment
Set up terraformrc for <COMPANY_NAME> modules in JFrog
Terraform backend details
Initialize Terraform
Terraform binary and providers version

##[debug]$LASTEXITCODE: 0

##[debug]Process exited with code 0 and signal null for tool '/usr/bin/pwsh'
##[debug]STDIO streams have closed and received exit code 0 and signal null for tool '/usr/bin/pwsh'
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;]Script exited with return code: 0
##[debug]which 'az'
##[debug]found: '/usr/bin/az'
##[debug]/usr/bin/az arg: account clear
##[debug]/usr/bin/az arg: account clear
##[debug]exec tool: /usr/bin/az
##[debug]exec tool: /usr/bin/az
##[debug]arguments:
##[debug]arguments:
##[debug] account
##[debug] account
##[debug] clear
##[debug] clear
/usr/bin/az account clear
Finishing: Initialize Terraform configuration

SUCCESSFUL RUN
==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version      : 2.262.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
/usr/bin/az --version
WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
azure-cli                         2.77.0 *

core 2.77.0 *
telemetry 1.1.0

Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0

Repro steps

- task: AzureCLI@2
    name: sampleTask
    displayName: sampleTask
    inputs:
      workingDirectory: ${{ parameters.workingDirectory }}
      scriptType: pscore
      scriptLocation: inlineScript
      azureSubscription: ${{ parameters.azureServiceConnection }}
      addSpnToEnvironment: true
      inlineScript: | <SCRIPT>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: ReleaseTask:AzureCLIArea:RM, Owners: @rvairavelu @manolerazvanbugregressionThis used to work, but a change in the service/tasks broke it.triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions