Repository navigation
Force JSON output when checking Azure CLI version - #649
Open
Joel Town Road (hippi345) wants to merge 1 commit into
Open
Joel Town Road (hippi345) wants to merge 1 commit into
Joel Town Road (hippi345) wants to merge 1 commit into
Conversation
az version is parsed as JSON for the pre-2.69 managed identity flag choice. AZURE_CORE_OUTPUT=none emptied that stdout, so parsing failed. Pass -o json so the check is independent of the user's default output.
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix and regression test address the reported failure with no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes #605 by ensuring Azure CLI version detection receives JSON even when AZURE_CORE_OUTPUT=none.
Changes:
- Adds
-o jsonto theaz versioninvocation. - Adds a regression test verifying explicit JSON output and successful version parsing.
| File | Description |
|---|---|
| src/Cli/AzureCliLogin.ts | Forces JSON output for version detection. |
| tests/AzureCliLogin.test.ts | Tests version parsing when default output is disabled. |
Review effort: Balanced
Joel Town Road (hippi345)
marked this pull request as ready for review
October 17, 2026 01:38
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #605.
When
AZURE_CORE_OUTPUT=noneis set (Azure CLI's recommended way to keep secrets out of logs),az versionprints nothing.AzureCliLogin.login()still parses that stdout as JSON to decide pre-2.69 vs 2.69+ managed-identity flags (--usernamevs--client-id). Empty output madeJSON.parsefail and producedFailed to parse Azure CLI version.There is no
CONTRIBUTINGin this repo requiring rebuiltlib//dist/bundles, so those compiled artifacts are not included.Fix
Pass
-o jsonon theaz versioninvocation so the captured output is JSON regardless ofAZURE_CORE_OUTPUT.Testing
New unit test in
__tests__/AzureCliLogin.test.tsmocks the az executor withAZURE_CORE_OUTPUT=none: stdout is empty unless-o json/--output jsonis present. It asserts those args and thatazure-clistill parses.Before (unmodified upstream master):
After:
This change was prepared with AI assistance. I remain responsible for the contribution and have reviewed it.