Repository navigation
[Core] az login: Allow opt-in to WSL broker authentication - #34461
Open
Phil Sphicas (philsphicas) wants to merge 1 commit into
Open
Phil Sphicas (philsphicas) wants to merge 1 commit into
Phil Sphicas (philsphicas) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
|
Thank you for your contribution Phil Sphicas (@philsphicas)! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Native WSL broker authentication requires end-to-end validation with the optional MSAL runtime and unlocked Secret Service keyring, as mocked tests cannot verify Windows account-picker, credential-cache, or broker-disabled fallback behavior.
No open issues 🎉
What changed in this PR
Adds opt-in WSL broker authentication to Azure CLI’s az login, allowing interactive sign-in without a Linux browser when MSAL enables the broker.
Changes:
- Passes
core.enable_broker_on_wslto MSAL and checks broker availability before falling back to device-code authentication. - Preserves explicit device-code and GitHub Codespaces precedence, with tests for login routing and opt-in behavior.
- Documents runtime installation, keyring setup, missing-library troubleshooting, and opting out.
| File | Description |
|---|---|
| src/azure-cli-core/azure/cli/core/tests/test_profile.py | Tests WSL broker routing, fallback precedence, and opt-in configuration. |
| src/azure-cli-core/azure/cli/core/auth/identity.py | Passes the WSL broker option to MSAL and exposes its enabled state. |
| src/azure-cli-core/azure/cli/core/_profile.py | Reads the opt-in setting and adjusts interactive login fallback. |
| doc/install_troubleshooting.md | Adds WSL broker setup and troubleshooting instructions. |
Review effort: Balanced
az login: Allow opt-in to WSL broker authentication
Contributor
|
Hi Phil Sphicas (@philsphicas), |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
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.
🤖 PR Validation —⚠️ Review suggested
This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.
1 added suppression
src/azure-cli-core/azure/cli/core/auth/identity.py# pylint: disable-next=protected-accessRelated command
az loginDescription
Add the opt-in
core.enable_broker_on_wslsetting and pass it to MSAL. When no Linux browser is available,az loginuses interactive sign-in if MSAL enables the WSL broker and falls back to device code otherwise. Explicit device-code sign-in and the GitHub Codespaces fallback retain priority.Document how to install the optional MSAL runtime, configure a Secret Service keyring, and resolve missing-library errors.
Testing Guide
On supported WSL, set up the optional runtime and unlocked keyring as described in
doc/install_troubleshooting.md. In a session without a Linux browser, run:az config set core.enable_broker_on_wsl=true az login --allow-no-subscriptions --output noneComplete sign-in in the Windows account picker. Use
az login --use-device-codeto verify that explicitly selecting device-code sign-in still works.History Notes
[Core]
az login: Allow opt-in to WSL broker authenticationThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.