azure-cli: az login command fails: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time...

All of the sudden az cli command started failing on my laptop with the following error: Please ensure you have network connection. Error detail:

HTTPSConnectionPool(host='login.microsoftonline.com', port=443)
: Max retries exceeded with url: /common/oauth2/devicecode?api-version=1.0 (Caused by NewConnectionError('<urllib3.conne
ction.VerifiedHTTPSConnection object at 0x03F5A9D0>: Failed to establish a new connection: [WinError 10060] A connection
 attempt failed because the connected party did not properly respond after a period of time, or established connection f
ailed because connected host has failed to respond',))

I tried setting up environmental variables HTTP_PROXY, HTTPS_PROXY, AZURE_CLI_DISABLE_CONNECTION_VERIFICATION, and ADAL_PYTHON_SSL_NO_VERIFY, but no luck. Please advise.


Environment summary

Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 30 (8 by maintainers)

Most upvoted comments

I was facing the same issue when running az login in my cmd:

“_HTTPSConnectionPool(host=‘login.microsoftonline.com’, port=443): Max retries exceeded with url: /common/oauth2/devicecode?api-version=1.0 (Caused by NewConnectionError (‘<urllib3.connection.VerifiedHTTPSConnection object at 0x03F5A9D0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond’,))”

I ran the following commands in cmd: set HTTP_PROXY= set HTTPS_PROXY=

After running the above commands, az login command worked.

Had the same problem but this fixed it:

set +H #if your password contains '!'
export http_proxy="<domain\username>:<password>@<proxy server URL>:<port>"
export https_proxy=“<proxy server URL>:<port>”
az login

gist

I removed auto generated values by WSL in /etc/resolv.conf and added google NS now it is able to resolve it.

# [network]
# generateResolvConf = false
nameserver 8.8.8.8

used the set HTTP_Proxy and HTTPS_Proxy commands and that didn’t work, but checked settings and there was an “all_proxy” value as well ; used set all_proxy= and that fixed the issue … end result all “proxy” settings are blank

Please re-open the issue (@tjprescott)!

I do have the same issue w/ az on Windows Linux Subsystem (Ubuntu) and a local CNTLM proxy:

Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/oauth2/devicecode?api-version=1.0 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',)))

Everything is OK with the native CMD based az login - I’d be happy if I could just copy over my credentials from Windows home to WLS home? But any action with az always tries to log me in again …

Had the same problem but this fixed it:

set +H #if your password contains '!'
export http_proxy="<domain\username>:<password>@<proxy server URL>:<port>"
export https_proxy=“<proxy server URL>:<port>”
az login

gist

I can confirm this fixes the issue for me on WSL Debian 9.