az login: Failed to establish a new connection: [Errno -2] Name does not resolve
See original GitHub issueThis is autogenerated. Please review and update as needed.
Describe the bug
When logging in with azure cli inside of mcr.microsoft.com/azure-cli:2.32.0 container I get an error (See below), The same login command works if I login outside of the container on my host.
Command Name
az login
Errors:
<urllib3.connection.HTTPSConnection object at 0x7f3ed60e6490>: Failed to establish a new connection: [Errno -2] Name does not resolve
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 --service-principal -u {} -p {} --tenant {}
Expected Behavior
Should have successfully signed in.
Environment Summary
Linux-5.4.0-99-generic-x86_64-with, Alpine Linux v3.14
Python 3.9.6
Installer: DOCKER
azure-cli 2.32.0 *
Additional Context
Running inside a mcr.microsoft.com/azure-cli:2.32.0 container
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
az login error- Failed to establish a new connection: [Errno -2 ...
I checked that I am able to resolve other external as well as internal url's without any problem. The problem so far seems...
Read more >Az login urllib3 [Errno 11001] getaddrinfo failed - Stack Overflow
This error will occur due to proxy (Internal Proxy or Corporate Proxy). ... I am trying to log into Azure on Powershell using...
Read more >How to view the tags key/value in a blob using login as ...
HTTPSConnection object at 0x7fb0eb30e200>: Failed to establish a new connection: [Errno -2] Name or service not known. Run the command a) az ......
Read more >Connection problems - doing CLI for Azure DevOps
How to fix connection problems · In addition to logging in through az devops login , make sure you are logged in to...
Read more >Name or service not known error appears when opening an ...
The same happens with the OOB Portal and any OAuth 2.0 event. Resolution. Ensure to add a record for the DNS name on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue seems to be with URL from inside docker only: https://management.azure.com/tenants?api-version=2019-11-01
Steps to reproduce: $ docker run -it --rm mcr.microsoft.com/azure-cli:latest bash-5.1# curl https://management.azure.com/tenants?api-version=2019-11-01 curl: (6) Could not resolve host: management.azure.com
Same command from outside docker works fine: $ curl https://management.azure.com/tenants?api-version=2019-11-01 {“error”:{“code”:“AuthenticationFailed”,“message”:“Authentication failed. The ‘Authorization’ header is missing.”}}
DNS resolution fails, but only from inside docker (outside docker works fine):
I ran into the same issue, and found out a workaround by adding the “–add-host=management.azure.com:20.40.227.150” to the docker command line.