Skip to content

Conversation

@ryan-altitudeit
Copy link

Fixes #21512

When the UseAzVersion feature flag is enabled, the AzureCLI@2 task runs 'az version' instead of 'az --version'. In some environments, 'az version' returns exit code 0 but with empty stdout, causing the version parsing to fail.

The existing fallback logic only checked for non-zero exit codes or stderr output, but didn't handle the case where stdout is empty or contains only whitespace.

This fix adds checks for empty stdout to trigger the fallback to 'az --version', ensuring the task works reliably.

Fixes microsoft#21512

When the UseAzVersion feature flag is enabled, the task runs 'az version'
instead of 'az --version'. In some environments, 'az version' returns exit
code 0 but with empty stdout, causing the version parsing to fail with:
'Can't parse az version from:'

The existing fallback logic only checked for non-zero exit codes or stderr,
but didn't handle the case where stdout is empty or contains only whitespace.

This fix adds checks for empty stdout to trigger the fallback to 'az --version',
ensuring the task works reliably regardless of the Azure CLI's version command
behavior.
@ryan-altitudeit ryan-altitudeit requested review from a team and manolerazvan as code owners December 2, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant