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.
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)
PS C:UsersXXX> az --version
azure-cli (2.0.29)
acr (2.0.22)
acs (2.0.28)
advisor (0.5.0)
appservice (0.1.29)
backup (1.0.7)
batch (3.1.11)
batchai (0.1.6)
billing (0.1.7)
cdn (0.0.13)
cloud (2.0.12)
cognitiveservices (0.1.11)
command-modules-nspkg (2.0.1)
configure (2.0.14)
consumption (0.2.2)
container (0.1.19)
core (2.0.29)
cosmosdb (0.1.19)
dla (0.0.18)
dls (0.0.19)
eventgrid (0.1.11)
eventhubs (0.1.0)
extension (0.0.10)
feedback (2.1.0)
find (0.2.8)
interactive (0.3.17)
iot (0.1.18)
keyvault (2.0.20)
lab (0.0.17)
monitor (0.1.3)
network (2.0.25)
nspkg (3.0.2)
profile (2.0.20)
rdbms (0.1.0)
redis (0.2.11)
reservations (0.1.1)
resource (2.0.25)
role (2.0.20)
servicebus (0.1.0)
servicefabric (0.0.11)
sql (2.0.23)
storage (2.0.27)
vm (2.0.28)
Python location 'C:Program Files (x86)Microsoft SDKsAzureCLI2python.exe'
Extensions directory 'C:UsersXXX.azurecliextensions'
Python (Windows) 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
@automagicallyio, are you configuring a proxy?
I'm having exactly the same issue on my machine. Was working fine for an hour this morning and then suddenly started to fail.
Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /c93deb30-8243-4d22-9077-526a7f52aa00/oauth2/token (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x107732630>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))
Looks like something in the local environment causes it. After opening a new shell, it works again.
@andreassisask Are you logging as a user or service principal?
@yugangw-msft I'm logging in as a user but not just login failed, all commands failed that required a network connection. Just opening a new shell corrected the issue, probably because the environment was reset.
Strangely enough az cli scripts did not work last week, but this week they are working again. Nothing in the scripts was changed. So, either our networking team did something or Microsoft did something. Weird.
There may have been a temporary service issue on the auth side. Please re-open if this issue recurs.
Hello Everyone,
I am experiencing this exact issue.
I dont understand why because when i fist begun it worked fine, after an hour or so i started receiving this error.
Any assistance is appreciated.
See Below-
az : 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 ProxyError('Cannot connect to proxy.',
NewConnectionError('
getaddrinfo failed',)))
At line:1 char:1
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 ('
I ran the following commands in cmd:
set HTTP_PROXY=
set HTTPS_PROXY=
After running the above commands, az login command worked.
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 ...
It is not about the credential, nor about that CLI having bugs which it doesn't. Cmd and WSL could have different network configuration system. You will need to configure the proxy setting with the credential in WLS correctly, otherwise, CLI (more accurately, the basic python requests package) would not work. There are a few blog posts covering this which I hope will help, say this one. To configure proxy with user name and password, check out here.
hi all,
I seeing the same issue irrespective of the CLI I use. I saw the below issue on "az network nic create"
Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /c4426c0b-036f-4bfb-b2d3-5c910c5389d6/oauth2/token (Caused by NewConnectionError('
This issue is not constant. Could anyone please tell me what is the reason that we are seeing this issue and solution for it?
If anyone else runs into this, I had Fiddler open with it's self signed cert which was breaking things.
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
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
I can confirm this fixes the issue for me on WSL Debian 9.
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
I'm having the same error. till yesterday my VS code was working fine , when i was working with azure. today when i did az login, its prompting me this error.
Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/oauth2/token (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
I saw you fixed the issue. Can you please explain the steps you followed. highly appreciable.
(Im having Windows10 laptop, proper connected to home wifi. havent done any changes in my laptop.)
az login issue happened .
Trying with the next one
Certificate verification failed. This typically happens when using Azure CLI behind a proxy that intercepts traffic with a self-signed certificate. Please add this certificate to the trusted CA bundle: https://github.com/Azure/azure-cli/blob/dev/doc/use_cli_effectively.md#working-behind-a-proxy. Error detail: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/oauth2/token (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))
It was working but sudden it stopped login,
I am using user account credential for login, not service principle.
Experiencing same issue while test deploying some ARM templates in Azure. Tested on Local Powershell ISE , Visual Studio Code but no joy. Tested the same ARM templates using old Azure-RM modules from Visual Studio Deployment Project and it worked like charm.
This is not good at all. Imagine I was deploying something critical. I was lucky that I have kept AzureRM, new Az Modules and also Azure CLI on my system. But i need someone from MSFT to look into this and let us know. Also, I have checked there are no outages on the regions which could have caused this.
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
@techadmin1982, Azure-RM is built on PowerShell which has different network logic as Azure CLI, which is built on Python.
If you are still facing the same issue with Azure CLI, please check your proxy setting and set HTTP_PROXY, HTTPS_PROXY or ALL_PROXY correctly, especially when the proxy uses Basic Authentication .
@esnell-midmark, HTTP_PROXY, HTTPS_PROXY and ALL_PROXY should have the same effect.
Could you try directly invoking requests?
# CMD
"C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -c "import requests; print(requests.get('https://login.microsoftonline.com/').status_code)"
# PowerShell
& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -c "import requests; print(requests.get('https://login.microsoftonline.com/').status_code)"
It will be great if you can create a new issue with detailed error message and proxy configuration provided. Thanks.
BTW, I have created https://github.com/psf/requests/issues/5558 to requests to report the missing ALL_PROXY doc.
@jiasli I created https://github.com/Azure/azure-cli/issues/14812 to track the bug with all_proxy setting
Most helpful comment
Had the same problem but this fixed it:
gist