From 47c76d2bdd52067831be203342d29bf4030395e8 Mon Sep 17 00:00:00 2001 From: Arnaud Lheureux Date: Wed, 27 May 2026 10:42:44 +0800 Subject: [PATCH] fix(prereq-check): parse az version via JSON on PowerShell PowerShell's native-command argument parser strips inner double-quotes from `--query '"azure-cli"'`, leaving JMESPath with an invalid unquoted hyphenated identifier. The CLI returns nothing, the script falls back to 'unknown', and the version compare flags az as OUTDATED even when it is current. Switch to `az version -o json | ConvertFrom-Json` and read the `azure-cli` property natively. This avoids the quoting issue entirely and keeps the TSV contract identical to check-tools.sh. Fixes #130 --- .github/skills/prereq-check/scripts/check-tools.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/skills/prereq-check/scripts/check-tools.ps1 b/.github/skills/prereq-check/scripts/check-tools.ps1 index 4afc3a2..04df2b2 100644 --- a/.github/skills/prereq-check/scripts/check-tools.ps1 +++ b/.github/skills/prereq-check/scripts/check-tools.ps1 @@ -57,7 +57,11 @@ $arch = if ($env:PROCESSOR_ARCHITECTURE) { "Platform: $os / $arch" Check-Tool 'az' { - az version --query '"azure-cli"' -o tsv + # Avoid `--query '"azure-cli"'` — PowerShell's native-command parser strips + # the inner double-quotes, leaving JMESPath with an unquoted hyphenated + # identifier (`azure-cli`) that fails to parse. Parse JSON instead. + $v = az version -o json 2>$null | ConvertFrom-Json + if ($v) { $v.'azure-cli' } else { '' } } Check-Tool 'gh' { $line = (gh --version 2>$null | Select-Object -First 1)