azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az login hangs on WSL 1

Open zielot opened this issue 4 years ago • 1 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az login

Errors:

The command failed with an unexpected error. Here is the traceback:
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f464592a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/opt/az/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/opt/az/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/opt/az/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect
    conn = self._new_conn()
  File "/opt/az/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f0f464592a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 783, in urlopen
    return self.urlopen(
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/opt/az/lib/python3.10/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f464592a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/profile/custom.py", line 139, in login
    subscriptions = profile.login(
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/_profile.py", line 152, in login
    user_identity = identity.login_with_device_code(scopes=scopes, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/identity.py", line 148, in login_with_device_code
    flow = self._msal_app.initiate_device_flow(scopes, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/identity.py", line 107, in _msal_app
    self._msal_app_instance = PublicClientApplication(self.client_id, **self._msal_app_kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 1525, in __init__
    super(PublicClientApplication, self).__init__(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 456, in __init__
    self.authority = Authority(
  File "/opt/az/lib/python3.10/site-packages/msal/authority.py", line 100, in __init__
    openid_config = tenant_discovery(
  File "/opt/az/lib/python3.10/site-packages/msal/authority.py", line 160, in tenant_discovery
    resp = http_client.get(tenant_discovery_endpoint, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/individual_cache.py", line 269, in wrapper
    value = function(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f464592a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az login --use-device-code

Expected Behavior

Environment Summary

Linux-4.4.0-19041-Microsoft-x86_64-with-glibc2.31, Debian GNU/Linux 11 (bullseye)
Python 3.10.5
Installer: DEB

azure-cli 2.40.0

Additional Context

Additional information

  • Windows 10, build19042.2006
  • WSL v1, Debian 11
  • Similar to issue #14473

zielot avatar Sep 27 '22 14:09 zielot

Duplicate of https://github.com/Azure/azure-cli/issues/21514

yonzhan avatar Sep 27 '22 22:09 yonzhan