Azure/aztfexport

A socket operation was attempted to an unreachable network

ABrizmohun opened this issue · 2 comments

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.             
  -------------------------------------------------------------------------------- 

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

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

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