Repository navigation
az login opens explorer.exe instead of browser since 2.85.0 #34203
Description
Describe the bug
after updating to 2.85.0 (or higher), az login opens the explorer.exe instead of a Browser.
downgrading to 2.84.0 or lower fixes the problem.
Related command
az login
Errors
no error
Issue script & Debug output
cli.knack.cli: Command arguments: ['login', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x78eb913a6e50>, <function OutputProducer.on_global_arguments at 0x78eb912c0040>, <function CLIQuery.on_global_arguments at 0x78eb912fa770>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Using packaged command index for profile 'latest'.
cli.azure.cli.core: Modules found from index for 'login': ['azure.cli.command_modules.profile']
cli.azure.cli.core: Loading command modules...
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: profile 0.002 2 8
cli.azure.cli.core: Loaded command modules:
cli.azure.cli.core: Total (1) 0.002 2 8
cli.azure.cli.core: Loaded 2 groups, 8 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : login
cli.azure.cli.core: Command table: login
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x78eb910d41a0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/gerhard/.azure/commands/2026-10-09.08-20-59.login.31403.log'.
az_command_data_logger: command args: login --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x78eb910f1a60>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x78eb910f1b10>, <function register_global_policy_argument..add_global_policy_argument at 0x78eb90ec4d50>, <function register_cache_arguments..add_cache_arguments at 0x78eb90ec4e00>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x78eb90ec4eb0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x78eb912c00f0>, <function CLIQuery.handle_query_parameter at 0x78eb912fa820>, <function register_ids_argument..parse_ids_arguments at 0x78eb90ec4ca0>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/gerhard/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/gerhard/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443
urllib3.connectionpool: https://login.microsoftonline.com:443 "GET /organizations/v2.0/.well-known/openid-configuration HTTP/1.1" 200 1777
cli.azure.cli.core.auth.binary_cache: save: /home/gerhard/.azure/msal_http_cache.bin
cli.azure.cli.core.auth.binary_cache: save: /home/gerhard/.azure/msal_http_cache.bin
msal.application: Broker enabled? None
cli.azure.cli.core.auth.identity: A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with az login --use-device-code.
msal.telemetry: Generate or reuse correlation_id: 9352e4b2-a40a-4947-bf5b-ea8f5d4a21a2
msal.oauth2cli.oauth2: Using http://localhost:33993 as redirect_uri
msal.oauth2cli.authcode: Abort by visit http://localhost:33993?error=abort
msal.oauth2cli.authcode: Open a browser on this device to visit: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=xxxxxx
Expected behavior
Open Browser to login
Environment Summary
azure-cli 2.91.0
core 2.91.0
telemetry 1.1.0
Dependencies:
msal 1.39.0
azure-mgmt-resource 24.0.0
Python location '/opt/az/bin/python3'
Config directory '/home/gerhard/.azure'
Extensions directory '/home/gerhard/.azure/cliextensions'
Python (Linux) 3.14.7 (main, Sep 29 2026, 06:44:28) [GCC 13.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
executed in a Windows 11 WSL2 Ubuntu Subsystem.
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.5 LTS"
BROWSER Env Variable is not set at all and if set does not fix the problem
Activity
yonzhan commentedon Oct 9, 2026
Thank you for opening this issue, we will look into it.
x-engineering-agent commentedon Oct 9, 2026
Bug Analysis
The report provides enough information for an implementation attempt; no additional reporter details are required before investigation.
Reported behavior: On Windows 11 with WSL2 Ubuntu 24.04.5,
az loginopens File Explorer instead of the authentication page. The reporter identifies 2.85.0 and later as affected and 2.84.0 and earlier as working. The supplied current environment is CLI/core 2.91.0, bundled Linux Python 3.14.7, and MSAL 1.39.0.BROWSERis normally unset, and setting it reportedly does not resolve the issue. These are reported observations, not an independently reproduced cause.Expected behavior: Open the interactive sign-in URL in the user's browser, with existing device-code behavior preserved.
Affected area: The handwritten profile login command and shared core authentication/browser integration in
Azure/azure-cli, targetingdev; this is not an extension-routing issue.Source evidence and limits
At inspected
devrevisioncc010d2104b3ab0089c33fb7eac8816c260a11ac,src/azure-cli-core/azure/cli/core/_profile.pyselects the interactive/device-code path andauth/identity.pydelegates interactive login to MSAL. Its browser-opening message precedes the launch and is not evidence that a browser opened successfully.The separate WSL-aware opener in
src/azure-cli-core/azure/cli/core/util.pyuses PowerShell with single-quoted, apostrophe-escaped URLs, then falls back to Python's browser opener onOSError. No connection from that utility opener to the inspected MSAL login path was identified. A utility-only change therefore must not be assumed to repairaz login.The 2.85.0 utility quoting change belongs to security hardening in #32885. Do not revert that protection or assume it caused this symptom. Both inspected 2.84.0 and 2.85.0 Debian build scripts pin Python 3.13.11; the reported release boundary is not proof of a Python 3.14 cause. The exact component that launches Explorer remains to be established. No later CLI-source fix was identified in the inspected login/opener methods. Similarity lookup was unavailable, so no duplicate classification was made.
Implementation requirements
BROWSERunset and set, browser executable paths containing spaces, and complete synthetic OAuth URLs with query parameters, apostrophes, and shell metacharacters. Preserve URL arguments without shell interpolation or command injection; do not log real authorization URLs, tokens, or credentials.src/azure-cli-core/azure/cli/core/tests/test_util.py,tests/test_profile.py, and/orauth/tests/test_identity.py. Existing profile tests mock identity, so they alone cannot establish a working launch path. Use the repository's focused core/authentication unit suites and document any real WSL/browser prerequisite that remains unverified.PR title & description format (required)
This repo enforces a PR format (guide). Please author the PR exactly as follows or CI's Check the Format of Pull Request Title and Content will fail.
Use this EXACT PR title (copy verbatim, do not reword):
Keep the backticks around the command and the
Fix #34203:prefix. You may only adjust the wording after the command (the final summary) if the fix changes; the[Profile]prefix, issue link, and backticked command must stay.Description — follow the PR template and fill in:
Fixes #34203.az ...command this affects.[Profile] `az <command>`: <note>.Automation
A durable Foundry implementation job has been queued with this scope. The exact cause and a working correction remain to be established; this analysis does not claim the issue is fixed.
Posted by x-engineering-agent (Fixer)
isra-fel commentedon Oct 13, 2026
I couldn't reproduce the issue but here's how MSAL (the library used by Azure CLI for auth) opens up the browser:
I suggest playing with these options to narrow down the problem. For me both $BROWSER and wslview weren't there, but "explorer.exe https://www.bing.com/" did bring up the browser.
microsoft-github-policy-service commentedon Oct 13, 2026
🔔 Routing this issue to @Azure/act-identity-squad.
gerhard-strauss-jambit commentedon Oct 13, 2026
Hi Yeming Liu (@isra-fel)
i´m not a programmer, but CoPilot provided the following script:
with 2.84.0 installed, i get this output and bing.com is opend in my browser:
with the current az-cli installed, the explorer.exe opens:
i dont have wslview installed and i dont think i want to because this Projekt is inactive for 2 years (and the Repo is archieved since march 2025). which also makes me question why the msla lib would do that
this change happend between msal 1.35.0b1 and 1.35.1 and it should be this PR
so does for me, but only if the Url does not contain an equal sign
explorer.exe https://www.bing.com/=this opens the explorer