Azure / aztfexport

A tool to bring existing Azure resources under Terraform's management
https://azure.github.io/aztfexport/
Mozilla Public License 2.0
1.59k stars 184 forks source link

A socket operation was attempted to an unreachable network #493

Closed ABrizmohun closed 8 months ago

ABrizmohun commented 8 months ago

I am running aztfexport version v0.14.0(fb772ba) in a devcontainer based on mcr.microsoft.com/devcontainers/base:bullseye and installed using devcontainer feature ghcr.io/devcontainers-contrib/features/aztfexport:1.

When running the following:

az login
az account set --subscription "xxx"
aztfexport resource-group my-resourcegroup

I get the following error after about a minute:

  listing resource set: executing ARG query "Resources | where resourceGroup =~ \"my-resourcegroup\" | order by id desc": DefaultAzureCredential authentication failed        
  GET http://169.254.169.254/metadata/identity/oauth2/token                                                                                                                           
  --------------------------------------------------------------------------------                                                                                                    
  RESPONSE 403 connecting to 169.254.169.254:80: connecting to 169.254.169.254:80: dial tcp 169.254.169.254:80: connectex: A socket operation was attempted to an unreachable network.
  --------------------------------------------------------------------------------                                                                                                    
  connecting to 169.254.169.254:80: connecting to 169.254.169.254:80: dial tcp 169.254.169.254:80: connectex: A socket operation was attempted to an unreachable network.             
  -------------------------------------------------------------------------------- 
magodo commented 8 months ago

By googling the error message, it brings me to this:

this usually means the local software knows no route to reach the remot host

ABrizmohun commented 8 months ago

This happens when I run it in a container. It works fine when I run it directly on the host machine.