-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
az login WSL 2 Ubuntu 18.04 does not open browser: Detect no GUI is available, so fall back to device code #14656
Comments
add to S174 |
We currently haven't developed and tested on WSL 2, so it is not supported yet. For now, you may use
|
@yonzhan, maybe I missed it, but was there any actual resolution? |
This feature is currently not supported in CLI and you can use the workaround provided by @jiasli . If you do want this, we can consider planning it in our backlog. Due to a bunch of high priority features, we do not have bandwidth to support it currently. Thanks for your understanding. |
I totally understand the priorities but a bit disappointing to see no support for WSL2 when Microsoft is now backporting it to Windows 10 19.09 and 19.03. |
Let me reopen it and put it into our roadmap. |
Just use below - its Display issue |
@schundu9, setting
to force env var Not only However, it will trigger a warning:
⚠ This is not the supported way to launch browser in WSL 2. |
Any updates on this? Still running into this issue in WSL2 |
@jackcoleman-iex, this issue has long been solved. 😊 Could you share the error message you see and the |
I am running into the same issue, except because I am using Ubuntu 20.04 and I used to have this working. I don't know why today it doesn't work. @jiasli this is the output I get with
|
Oh crap now I got the web browser opening. It took surprisingly long. More surprising is the fact that it opened long after I pressed |
Azure CLI uses MSAL which uses Python's built-in library def _browse(auth_uri, browser_name=None): # throws ImportError, webbrowser.Error
"""Browse uri with named browser. Default browser is customizable by $BROWSER"""
import webbrowser # Lazy import. Some distro may not have this.
if browser_name:
browser_opened = webbrowser.get(browser_name).open(auth_uri)
else:
# This one can survive BROWSER=nonexist, while get(None).open(...) can not
browser_opened = webbrowser.open(auth_uri)
# In WSL which doesn't have www-browser, try launching browser with PowerShell
if not browser_opened and is_wsl():
try:
import subprocess
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe
# Ampersand (&) should be quoted
exit_code = subprocess.call(
['powershell.exe', '-NoProfile', '-Command', 'Start-Process "{}"'.format(auth_uri)])
browser_opened = exit_code == 0
except FileNotFoundError: # WSL might be too old
pass
return browser_opened
|
I was facing same issues on WSL2 with ubuntu 22.04 but I figure out using the below command.
when you will run this command in wsl2 or on ubuntu application in windows, it will open some other window, in my case I just press key this line will contain link to login and authenticate, just copy and hit into browser and it will authenticate you. Also, important this is that think link must contain |
Hi @abdurrehman11, I am not aware of a window/app that allows you to press |
This helped me out: Azure/azure-dev#2291 (comment) |
Describe the bug
When running command
az login
web browser won't open.Running on verbose mode
To Reproduce
Run
az login
on WSL 2 Ubuntu 18.04Expected behavior
Default browser opens on AZ login page.
Environment summary
Windows 10 Pro 2004
WSL 2 Ubuntu 18.04
Additional context
Running
opens successfully the browser on the Azure CLI issues page.
The text was updated successfully, but these errors were encountered: