Skip to content

az login cannot open web browser on WSL2 + Ubuntu 22.04 #27879

Open

Description

@jiasli

Describe the bug
az login cannot open web browser on WSL2 + Ubuntu 22.04.

Upstream issues:

To Reproduce

With xdg-utils installed:

$ sudo apt install xdg-utils
$ az login
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`.
/usr/bin/xdg-open: 882: x-www-browser: not found
/usr/bin/xdg-open: 882: firefox: not found
/usr/bin/xdg-open: 882: iceweasel: not found
/usr/bin/xdg-open: 882: seamonkey: not found
/usr/bin/xdg-open: 882: mozilla: not found
/usr/bin/xdg-open: 882: epiphany: not found
/usr/bin/xdg-open: 882: konqueror: not found
/usr/bin/xdg-open: 882: chromium: not found
/usr/bin/xdg-open: 882: chromium-browser: not found
/usr/bin/xdg-open: 882: google-chrome: not found
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&...'

Without xdg-utils installed:

$ sudo apt remove xdg-utils
$ az login
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`.
gio: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&...: Operation not supported

Additional context
Windows Terminal supports Ctrl+Click to open hyperlinks, so the user can Ctrl+Click the URL shown in the error to open the web browser and the rest steps work as usual.

Some workarounds are provided in microsoft/WSL#8892 such as installing wslu.

Activity

  1. added
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Nov 20, 2023
  2. yonzhan commented on Nov 20, 2023

    @yonzhan
    Collaborator

    Thank you for opening this issue, we will look into it.

  3. added this to the Backlog milestone on Nov 20, 2023
  4. jiasli commented on Dec 1, 2023

    @jiasli
    ContributorAuthor

    Workaround

    Windows Terminal supports Ctrl+Click to open URLs, so the easiest workaround is to Ctrl+Click the URL shown in the error to open the web browser.

    image

    If you are not using Windows Terminal, you may manually copy the URL into a web browser to open it.

  5. MattMcL4475 commented on Mar 2, 2024

    @MattMcL4475
    Member

    I have the same issue. Yong Zhang (@yonzhan) any ideas on how to fix or the root cause? Windows 11, wsl2, Ubuntu 22.04.3 LTS

  6. RuoyuWang-MS commented on Apr 24, 2024

    @RuoyuWang-MS

    Same issue using the latest DevBox env. I think the devbox envs setup recently all share the config Win11 WSL2 Ubuntu 22.04.4 LTS as default. So the many developers using devbox may encounter this issue. Do we have any plan fix for this issue? Jiashuo Li (@jiasli) Yong Zhang (@yonzhan) Thanks in advance!

  7. jiasli commented on Apr 24, 2024

    @jiasli
    ContributorAuthor

    This is not an Azure CLI issue. It is recommended to report to microsoft/WSL#8892.

  8. RuoyuWang-MS commented on Apr 24, 2024

    @RuoyuWang-MS

    This is not an Azure CLI issue. It is recommended to report to microsoft/WSL#8892.

    Thanks! Can be solved by these steps microsoft/WSL#8892 (comment)

  9. dylanw-oss commented on Jun 1, 2024

    @dylanw-oss

    Workaround

    Windows Terminal supports Ctrl+Click to open URLs, so the easiest workaround is to Ctrl+Click the URL shown in the error to open the web browser.

    image

    If you are not using Windows Terminal, you may manually copy the URL into a web browser to open it.

    Thanks Jiashuo Li (@jiasli), this workaround "manually copy the URL to web browser" works for me! I'm using WSL and ctrl+click the link can open browser but got "Sorry, but we’re having trouble signing you in. AADSTS90023: Unsupported 'prompt' value."

  10. BlackRider97 commented on Jun 30, 2024

    @BlackRider97
    Member
    image

    Remove the : after select_account from URL while opening in your browser.

  11. jiasli commented on Jul 1, 2024

    @jiasli
    ContributorAuthor

    I'm using WSL and ctrl+click the link can open browser but got "Sorry, but we’re having trouble signing you in. AADSTS90023: Unsupported 'prompt' value."

    Remove the : after select_account from URL while opening in your browser.

    This is caused by a recent Windows Terminal bug microsoft/terminal#17495.

  12. magodo commented on Oct 15, 2025

    @magodo
    Member

    A workaround I've been using is to put the following in your shell profile:

    export BROWSER='/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'
  13. alisade commented on Dec 18, 2025

    @alisade
    sudo ln -s '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe' /usr/local/bin/www-browser
    

    solved the problem for me

  14. jiasli commented on Jan 7, 2026

    @jiasli
    ContributorAuthor

    If your tenant (such as Microsoft) requires using Microsoft Edge to log in, you may set Microsoft Edge as the default browser with:

    export BROWSER="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
  15. EnQing626 commented on Apr 28, 2026

    @EnQing626

    Workaround

    Windows Terminal supports Ctrl+Click to open URLs, so the easiest workaround is to Ctrl+Click the URL shown in the error to open the web browser.

    image

    If you are not using Windows Terminal, you may manually copy the URL into a web browser to open it.

    Thank you. It works for me.

  16. alisade commented on May 2, 2026

    @alisade

    Workaround

    Windows Terminal supports Ctrl+Click to open URLs, so the easiest workaround is to Ctrl+Click the URL shown in the error to open the web browser.
    image
    If you are not using Windows Terminal, you may manually copy the URL into a web browser to open it.

    Thank you. It works for me.

    the problem for me is that the url does not print

  17. fhennig42 commented on May 28, 2026

    @fhennig42

    the problem for me is that the url does not print

    Same here. Only the yellow text is shown.

  18. alisade commented on May 28, 2026

    @alisade

    Export both DISPLAY and BROWSER env vars

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions