Skip to content
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 open browser, but then it hangs #26196

Closed
MPettersen opened this issue Apr 19, 2023 · 6 comments
Closed

az login open browser, but then it hangs #26196

MPettersen opened this issue Apr 19, 2023 · 6 comments
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@MPettersen
Copy link

This is autogenerated. Please review and update as needed.

Describe the bug

When running either az login or az login --use-device-code I get the same result.
It opens the browser I login through SSO, everything looks right from the browser side, but in the terminal it is simply stuck.
And a few minutes later the error shown below appears.

I have tried to use multiple versions of the azure-cli, different versions of python.
And I also did a clean install of the WSL.

When running in debug it does receive a response from the browser with the client info, but it's not able to use this any further.

This works fine when running from powershell in windows, but I get this error every time in WSL.
This used to work earlier, but now for some reason it no longer does.

Command Name
az login

Errors:

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 154, in login
    user_identity = identity.login_with_auth_code(scopes=scopes, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/identity.py", line 153, in login_with_auth_code
    result = self._msal_app.acquire_token_interactive(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 1828, in acquire_token_interactive
    response = _clean_up(self.client.obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 281, in obtain_token_by_browser
    return super(Client, self).obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 639, in obtain_token_by_browser
    return self._obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 677, in _obtain_token_by_browser
    return self.obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 142, in obtain_token_by_auth_code_flow
    return super(_ClientWithCcsRoutingInfo, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 205, in obtain_token_by_auth_code_flow
    result = super(Client, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 547, in obtain_token_by_auth_code_flow
    return self._obtain_token_by_authorization_code(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 731, in _obtain_token_by_authorization_code
    return self._obtain_token("authorization_code", data=data, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 116, in _obtain_token
    ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 771, in _obtain_token
    resp = super(Client, self)._obtain_token(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 234, in _obtain_token
    resp = (post or self._http_client.post)(
  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/msal/individual_cache.py", line 269, in wrapper
    value = function(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **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 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

To Reproduce:

Steps to reproduce the behavior.

  • az login

Expected Behavior

Environment Summary

Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31, Ubuntu 20.04.5 LTS
Python 3.10.10
Installer: DEB

azure-cli 2.47.0

Additional Context

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Apr 19, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 19, 2023

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

@ghost ghost assigned jiasli Apr 19, 2023
@ghost ghost added this to the Backlog milestone Apr 19, 2023
@ghost ghost added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Installation labels Apr 19, 2023
@jiasli
Copy link
Member

jiasli commented Apr 20, 2023

You issue seems to be different from #26180, since both az login and az login --use-device-code are broken, and they didn't fail in the browser.

According to the debug log, it fails at

  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 234, in _obtain_token
    resp = (post or self._http_client.post)(

https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/2afec138f85ec0e6af65a147f77902898f828655/msal/oauth2cli/oauth2.py#L234

Could you verify if you can connect to https://login.microsoftonline.com/ with Python:

python3 -c "import requests; print(requests.get('https://login.microsoftonline.com/').status_code)"
200

Also, could you also share the output of both az login --debug and az login --use-device-code --debug? Please remove any sensitive information.

@MPettersen
Copy link
Author

Yes, I can confirm that I am able to connect to https://login.microsoftonline.com/ with Python:
image

The login to the browser behaves exactly the same as when I login from windows (powershell), except that for windows powershell gets the response and manages to actually log in.

Using a service principal does not work either: az login --service-principal, here it just hangs until it times out.

Debug logs:

az login --debug

(base) m@PF26E8TA:~$ az login --debug
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 0x7fad7f6492d0>, <function OutputProducer.on_global_arguments at 0x7fad7f547eb0>, <function CLIQuery.on_global_arguments at 0x7fad7f595120>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
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.007         2         9
cli.azure.cli.core: Total (1)                 0.007         2         9
cli.azure.cli.core: Loaded 2 groups, 9 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 0x7fad7e5829e0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/m/.azure/commands/2023-04-20.09-26-06.login.32012.log'.
az_command_data_logger: command args: login --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fad7e5cb760>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fad7e5cb5b0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fad7e5cb6d0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fad7f547f40>, <function CLIQuery.handle_query_parameter at 0x7fad7f5951b0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fad7e5cb640>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/m/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/m/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/organizations/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/{tenantid}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/organizations/kerberos', 'tenant_region_scope': None, 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
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: REDACTED
msal.oauth2cli.oauth2: Using http://localhost:36999 as redirect_uri
msal.oauth2cli.authcode: Abort by visit http://localhost:36999?error=abort
msal.oauth2cli.authcode: Open a browser on this device to visit: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=REDACTED&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A36999&scope=https%3A%2F%2Fmanagement.core.windows.net%2F%2F.default+offline_access+openid+profile&state=REDACTED&code_challenge=REDACTED&code_challenge_method=S256&nonce=REDACTED&client_info=1&claims=%7B%22access_tokenREDACTEDxms_ccREDACTEDvaluesREDACTED&prompt=select_account
<-- (This comment not part of the debugging, this is the log before loggin into the browser) -->
msal.oauth2cli.authcode: Got auth response: {'code': 'REDACTED', 'client_info': 'REDACTED', 'state': 'REDACTED', 'session_state': 'REDACTED'}
msal.oauth2cli.authcode: "GET /?code=REDACTED&client_info=REDACTED&state=REDACTED&session_state=REDACTED HTTP/1.1" 200 -
urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443
<-- (This comment not part of the debugging, but this is where it is stuck after logging in with the browser) -->
cli.azure.cli.core.azclierror: 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 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/opt/az/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/opt/az/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/opt/az/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

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 755, in urlopen
    retries = retries.increment(
  File "/opt/az/lib/python3.10/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/opt/az/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  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 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/opt/az/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/opt/az/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/opt/az/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

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 154, in login
    user_identity = identity.login_with_auth_code(scopes=scopes, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/identity.py", line 153, in login_with_auth_code
    result = self._msal_app.acquire_token_interactive(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 1828, in acquire_token_interactive
    response = _clean_up(self.client.obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 281, in obtain_token_by_browser
    return super(Client, self).obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 639, in obtain_token_by_browser
    return self._obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 677, in _obtain_token_by_browser
    return self.obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 142, in obtain_token_by_auth_code_flow
    return super(_ClientWithCcsRoutingInfo, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 205, in obtain_token_by_auth_code_flow
    result = super(Client, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 547, in obtain_token_by_auth_code_flow
    return self._obtain_token_by_authorization_code(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 731, in _obtain_token_by_authorization_code
    return self._obtain_token("authorization_code", data=data, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 116, in _obtain_token
    ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 771, in _obtain_token
    resp = super(Client, self)._obtain_token(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 234, in _obtain_token
    resp = (post or self._http_client.post)(
  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/msal/individual_cache.py", line 269, in wrapper
    value = function(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **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 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
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 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/opt/az/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/opt/az/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/opt/az/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

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 755, in urlopen
    retries = retries.increment(
  File "/opt/az/lib/python3.10/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/opt/az/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  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 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/opt/az/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/opt/az/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/opt/az/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

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 154, in login
    user_identity = identity.login_with_auth_code(scopes=scopes, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/identity.py", line 153, in login_with_auth_code
    result = self._msal_app.acquire_token_interactive(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 1828, in acquire_token_interactive
    response = _clean_up(self.client.obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 281, in obtain_token_by_browser
    return super(Client, self).obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 639, in obtain_token_by_browser
    return self._obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 677, in _obtain_token_by_browser
    return self.obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 142, in obtain_token_by_auth_code_flow
    return super(_ClientWithCcsRoutingInfo, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 205, in obtain_token_by_auth_code_flow
    result = super(Client, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 547, in obtain_token_by_auth_code_flow
    return self._obtain_token_by_authorization_code(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 731, in _obtain_token_by_authorization_code
    return self._obtain_token("authorization_code", data=data, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 116, in _obtain_token
    ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 771, in _obtain_token
    resp = super(Client, self)._obtain_token(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 234, in _obtain_token
    resp = (post or self._http_client.post)(
  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/msal/individual_cache.py", line 269, in wrapper
    value = function(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **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 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
az_command_data_logger: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
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 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/opt/az/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/opt/az/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/opt/az/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

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 755, in urlopen
    retries = retries.increment(
  File "/opt/az/lib/python3.10/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/opt/az/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  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 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/opt/az/lib/python3.10/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/opt/az/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/opt/az/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/opt/az/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

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 154, in login
    user_identity = identity.login_with_auth_code(scopes=scopes, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/identity.py", line 153, in login_with_auth_code
    result = self._msal_app.acquire_token_interactive(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 1828, in acquire_token_interactive
    response = _clean_up(self.client.obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 281, in obtain_token_by_browser
    return super(Client, self).obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 639, in obtain_token_by_browser
    return self._obtain_token_by_browser(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 677, in _obtain_token_by_browser
    return self.obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/application.py", line 142, in obtain_token_by_auth_code_flow
    return super(_ClientWithCcsRoutingInfo, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 205, in obtain_token_by_auth_code_flow
    result = super(Client, self).obtain_token_by_auth_code_flow(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 547, in obtain_token_by_auth_code_flow
    return self._obtain_token_by_authorization_code(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 731, in _obtain_token_by_authorization_code
    return self._obtain_token("authorization_code", data=data, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 116, in _obtain_token
    ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 771, in _obtain_token
    resp = super(Client, self)._obtain_token(
  File "/opt/az/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 234, in _obtain_token
    resp = (post or self._http_client.post)(
  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/msal/individual_cache.py", line 269, in wrapper
    value = function(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **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 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
To open a new issue, please run `az feedback`
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fad7e582c20>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 134.661 seconds (init: 0.598, invoke: 134.063)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 6856 in cache
telemetry.check: Returns Positive.
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/bin/../../opt/az/bin/python3 /opt/az/lib/python3.10/site-packages/azure/cli/telemetry/__init__.py /home/m/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

az login --use-device-code --debug

(base) m@PF26E8TA:~$ az login --use-device-code --debug
cli.knack.cli: Command arguments: ['login', '--use-device-code', '--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 0x7f40553292d0>, <function OutputProducer.on_global_arguments at 0x7f405522beb0>, <function CLIQuery.on_global_arguments at 0x7f4055279120>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
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         9
cli.azure.cli.core: Total (1)                 0.002         2         9
cli.azure.cli.core: Loaded 2 groups, 9 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 0x7f405426a9e0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/m/.azure/commands/2023-04-20.09-44-14.login.32177.log'.
az_command_data_logger: command args: login --use-device-code --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f4054283520>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f40542cd480>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f40542cd5a0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f405522bf40>, <function CLIQuery.handle_query_parameter at 0x7f40552791b0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7f40542cd510>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/m/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/m/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/organizations/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/{tenantid}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/organizations/kerberos', 'tenant_region_scope': None, 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/devicecode HTTP/1.1" 200 473
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code REDACTED to authenticate.
msal.telemetry: Generate or reuse correlation_id: REDACTED
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 400 510
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 400 510
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 400 510
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 400 510
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 400 510
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 400 510
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 200 8833
msal.token_cache: event={
    "client_id": "REDACTED",
    "data": {
        "claims": "{\"access_token\": {\"xms_cc\": {\"values\": [\"CP1\"]}}}",
        "client_id": "REDACTED",
        "code": "REDACTED",
        "device_code": "REDACTED"
    },
    "environment": "login.microsoftonline.com",
    "grant_type": "urn:ietf:params:oauth:grant-type:device_code",
    "params": null,
    "response": {
        "access_token": "********",
        "client_info": "REDACTED",
        "expires_in": 4134,
        "ext_expires_in": 4134,
        "foci": "1",
        "id_token": "********",
        "refresh_token": "********",
        "scope": "https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default",
        "token_type": "Bearer"
    },
    "scope": [
        "https://management.core.windows.net//user_impersonation",
        "https://management.core.windows.net//.default"
    ],
    "token_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token"
}
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/organizations/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/{tenantid}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/organizations/kerberos', 'tenant_region_scope': None, 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: REDACTED
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/tenants?api-version=2019-11-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'REDACTED'
cli.azure.cli.core.sdk.policies:     'CommandName': 'login'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--use-device-code --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.10 (Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/tenants?api-version=2019-11-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'REDACTED'
cli.azure.cli.core.sdk.policies:     'CommandName': 'login'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--use-device-code --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.10 (Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (2): management.azure.com:443
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/tenants?api-version=2019-11-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'REDACTED'
cli.azure.cli.core.sdk.policies:     'CommandName': 'login'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--use-device-code --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.10 (Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (3): management.azure.com:443
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/tenants?api-version=2019-11-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'REDACTED'
cli.azure.cli.core.sdk.policies:     'CommandName': 'login'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--use-device-code --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.10 (Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (4): management.azure.com:443
cli.azure.cli.core.azclierror: 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 176, in login
    subscriptions = subscription_finder.find_using_common_tenant(username, credential)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/_profile.py", line 740, in find_using_common_tenant
    for t in tenants:
  File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 129, in __next__
    return next(self._page_iterator)
  File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 76, in __next__
    self._response = self._get_next(self.continuation_token)
  File "/opt/az/lib/python3.10/site-packages/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py", line 737, in get_next
    pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 211, in run
    return first_node.send(pipeline_request)  # type: ignore
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  [Previous line repeated 2 more times]
  File "/opt/az/lib/python3.10/site-packages/azure/mgmt/core/policies/_base.py", line 47, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/policies/_redirect.py", line 158, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/policies/_retry.py", line 468, in send
    raise err
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/policies/_retry.py", line 446, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/policies/_authentication.py", line 119, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  [Previous line repeated 1 more time]
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 103, in send
    self._sender.send(request.http_request, **request.context.options),
  File "/opt/az/lib/python3.10/site-packages/azure/core/pipeline/transport/_requests_basic.py", line 361, in send
    raise error
azure.core.exceptions.ServiceResponseError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

cli.azure.cli.core.azclierror: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
az_command_data_logger: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f405426ac20>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 538.350 seconds (init: 0.152, invoke: 538.197)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3404 in cache
telemetry.check: Returns Positive.
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/bin/../../opt/az/bin/python3 /opt/az/lib/python3.10/site-packages/azure/cli/telemetry/__init__.py /home/m/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

@jiasli
Copy link
Member

jiasli commented Apr 20, 2023

The weird thing is these 2 pieces of logs fail at different network requests.

The first one fails at a request to AAD:

urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443

The second one succeeds at request to AAD (200 status code):

urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 200 8833

but fails at a request to ARM:

urllib3.connectionpool: Starting new HTTPS connection (4): management.azure.com:443

It really looks like WSL network issue to me.

@yonzhan yonzhan closed this as completed May 15, 2023
@fenixam
Copy link

fenixam commented Feb 6, 2024

@yonzhan,
@jiasli
What is the resolution for this issues as I faced it also on latest az cli and wsl Ubuntu 22.04 distribution but only on one of Windows machines (from many)
Everything is working except login to Azure.

@fenixam
Copy link

fenixam commented Feb 6, 2024

@MPettersen where you able to solve the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants