Azure / caf-terraform-landingzones

This solution, offered by the Open-Source community, will no longer receive contributions from Microsoft. Customers are encouraged to transition to Microsoft Azure Verified Modules for continued support and updates from Microsoft. Please note, this repository is scheduled for decommissioning and will be removed on July 1, 2025.
https://github.com/aztfmod/caf-terraform-landingzones
MIT License
764 stars 665 forks source link

[bug] Rover login command fails when running in VS Code container #250

Open paolosalvatori opened 3 years ago

paolosalvatori commented 3 years ago

Describe the bug The rover login command fails when trying to login after following the instructions at Getting started with Azure Cloud Adoption Framework landing zones for Terraform

vscode@f912543adaf1:/tf/caf$ rover login

  /$$$$$$   /$$$$$$  /$$$$$$$$       /$$$$$$$
 /$$__  $$ /$$__  $$| $$_____/      | $$__  $$
| $$  \__/| $$  \ $$| $$            | $$  \ $$  /$$$$$$  /$$    /$$/$$$$$$   /$$$$$$
| $$      | $$$$$$$$| $$$$$         | $$$$$$$/ /$$__  $$|  $$  /$$/$$__  $$ /$$__  $$
| $$      | $$__  $$| $$__/         | $$__  $$| $$  \ $$ \  $$/$$/ $$$$$$$$| $$  \__/
| $$    $$| $$  | $$| $$            | $$  \ $$| $$  | $$  \  $$$/| $$_____/| $$
|  $$$$$$/| $$  | $$| $$            | $$  | $$|  $$$$$$/   \  $/ |  $$$$$$$| $$
 \______/ |__/  |__/|__/            |__/  |__/ \______/     \_/   \_______/|__/

              version: aztfmod/rover:1.0.1-2106.3012

@calling verify_azure_session

Checking existing Azure session
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.connection.HTTPSConnection object at 0x7fb6d23e4e50>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))
Error on or near line 206; exiting with status 1
Error on or near line 206; exiting with status 1

@calling clean_up_variables
cleanup variables
clean_up backend_files

Even az login command fails, ore better, I can successfully login via browser, but the command fails with the following error:

vscode@f912543adaf1:/tf/caf$ az login 
The default web browser has been opened at https://login.microsoftonline.com/common/oauth2/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`.
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 NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc94e5c0130>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))

Also, note that the folder name shown close to the green button in VS Code lower bar is not Azure CAF rover, but CAF Starter Terraform landing zones.

To Reproduce 1.I cloned the repo as shown in the instructions using git clone https://github.com/Azure/caf-terraform-landingzones-starter.git 2.Opened the folder in VS Code 3.Clicked the green button and selected Open folder in container... 4.Run rover login in the prompt command

Expected behavior I would expect to successfully login.

Screenshots See the text above.

Configuration (please complete the following information):

vijayyadavcloud commented 3 years ago

It worked for me when I replaced Docker version 3.5.2 (66501) instead of 4.0.0 (Latest) Docker

paolosalvatori commented 3 years ago

Yes, I installed version 4.0.0 last week, so the problem is probably due to a regression bug in the network runtime of the new version of Docker DE for Windows.

image

larrywa commented 2 years ago

I noticed the same issue with the Rover login this morning. I tried installing an older version of Docker Desktop and then restarting VS Code. My Docker Desktop version is 3.6.0.

arnoldromeijn commented 2 years ago

I have run into the same problem. Docker Desktop 4.1.1 (69879)

CHolmesAtLVS commented 2 years ago

I have run into the same problem using Docker Desktop 4.1.1 (69879). 'az login' fails with the same issue, so I assume that's part of the issue. 'az login' on other Ubuntu-based containers works fine though, so it appears to be an issue with the rover container.

dmunkovpax8 commented 1 year ago

It is a DNS issue within Docker container. Solveable if you add custom dns parameter in Settings -> Docker Engine

"dns": [
    "8.8.8.8"
  ],