Skip to content

[Core] az login: Allow opt-in to WSL broker authentication - #34461

Open
Phil Sphicas (philsphicas) wants to merge 1 commit into
Azure:devfrom
philsphicas:wsl-wam-broker
Open

Phil Sphicas (philsphicas) wants to merge 1 commit into
Azure:devfrom
philsphicas:wsl-wam-broker

Conversation

@philsphicas

@philsphicas Phil Sphicas (philsphicas) commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
️✔️ None ️✔️ 130/130 ⚠️ 1 added

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
File Line Kind Code
src/azure-cli-core/azure/cli/core/auth/identity.py 137 pylint # pylint: disable-next=protected-access

Related command

az login

Description

Add the opt-in core.enable_broker_on_wsl setting and pass it to MSAL. When no Linux browser is available, az login uses 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 none

Complete sign-in in the Windows account picker. Use az login --use-device-code to verify that explicitly selecting device-code sign-in still works.

History Notes

[Core] az login: Allow opt-in to WSL broker authentication


This checklist is used to make sure that common guidelines for a pull request are followed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 00:46
@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Nov 19, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Phil Sphicas (@philsphicas)! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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_wsl to 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

@philsphicas Phil Sphicas (philsphicas) changed the title [Core] az login: Allow opt-in to WSL broker authentication [Core] az login: Allow opt-in to WSL broker authentication Nov 19, 2026
@x-engineering-agent
x-engineering-agent Bot requested a review from a team November 19, 2026 00:56
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Hi Phil Sphicas (@philsphicas),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Account az login/account act-identity-squad act-platform-engineering-squad Core CLI core infrastructure customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants