Skip to content

Error to login using az login: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /xxx/v2.0/.well-known/openid-configuration (Caused by ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))) #30641

@sabahirfan

Description

@sabahirfan

Describe the bug

When I run az login, I get error to login using az login, it redirects to Microsoft login after successful login on Microsoft I get the error:

az-client version info:

az --version                                                                                                                                                                                                                 

azure-cli                         2.67.0

core                              2.67.0
telemetry                          1.1.0

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location '/usr/local/Cellar/azure-cli/2.67.0_1/libexec/bin/python'
Extensions directory '/Users/sabah/.azure/cliextensions'

Python (Darwin) 3.12.8 (main, Dec  3 2024, 18:42:41) [Clang 16.0.0 (clang-1600.0.26.4)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Related command

az login

Errors

az login                                                                                           ✔  10019  18:06:35
/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/batch/models/_models_py3.py:4839: SyntaxWarning: invalid escape sequence '\s'
  """A Job Preparation Task to run before any Tasks of the Job on any given
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`.

Retrieving tenants and subscriptions for the selection...







The command failed with an unexpected error. Here is the traceback:
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /531ff96d-0ae9-462a-8d2d-bec7c0b42082/v2.0/.well-known/openid-configuration (Caused by ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')))
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1060, in _validate_conn
    conn.connect()
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
                ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1041, in _create
    self.do_handshake()
  File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1319, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/connectionpool.py", line 829, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/connectionpool.py", line 801, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/urllib3/util/retry.py", line 594, 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: /531ff96d-0ae9-462a-8d2d-bec7c0b42082/v2.0/.well-known/openid-configuration (Caused by ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/command_modules/profile/custom.py", line 173, in login
    subscriptions = profile.login(
                    ^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/_profile.py", line 203, in login
    subscriptions = subscription_finder.find_using_common_tenant(username, credential)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/_profile.py", line 838, in find_using_common_tenant
    specific_tenant_credential = identity.get_user_credential(username)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/auth/identity.py", line 248, in get_user_credential
    return UserCredential(self.client_id, username, **self._msal_public_app_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/auth/msal_credentials.py", line 38, in __init__
    self._msal_app = PublicClientApplication(client_id, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/msal/application.py", line 1974, in __init__
    super(PublicClientApplication, self).__init__(
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/msal/application.py", line 608, in __init__
    self.authority = Authority(
                     ^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/msal/authority.py", line 79, in __init__
    openid_config = tenant_discovery(
                    ^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/msal/authority.py", line 210, in tenant_discovery
    resp = http_client.get(tenant_discovery_endpoint, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/msal/individual_cache.py", line 269, in wrapper
    value = function(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.67.0_1/libexec/lib/python3.12/site-packages/requests/adapters.py", line 700, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /531ff96d-0ae9-462a-8d2d-bec7c0b42082/v2.0/.well-known/openid-configuration (Caused by ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')))

Issue script & Debug output

az login

Expected behavior

It should successfully complete the az login flow.

Environment Summary

az --version

azure-cli 2.67.0

core 2.67.0
telemetry 1.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location '/usr/local/Cellar/azure-cli/2.67.0_1/libexec/bin/python'
Extensions directory '/Users/sabah/.azure/cliextensions'

Python (Darwin) 3.12.8 (main, Dec 3 2024, 18:42:41) [Clang 16.0.0 (clang-1600.0.26.4)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

Labels

Accountaz login/accountAuto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamPossible-SolutionSimilar-Issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions