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

Unable to get this working #491

Closed sssd-dev closed 9 months ago

sssd-dev commented 9 months ago

Getting below error -

listing resource set: executing ARG query "Resources | where resourceGroup =~ \"xxxx\" | order by id desc": POST
  https://management.azure.com/providers/Microsoft.ResourceGraph/resources
  --------------------------------------------------------------------------------
  RESPONSE 400: 400 Bad Request
  ERROR CODE: BadRequest
  --------------------------------------------------------------------------------
  {
    "error": {
      "code": "BadRequest",
      "message": "Please provide below info when asking for support: timestamp = 2024-01-03T00:55:29.5556950Z, correlationId =
  05f5e58e-03ef-4aea-a6d7-7200f7e742f6.",
      "details": [
        {
          "code": "NoValidSubscriptionsInQueryRequest",
          "message": "There must be at least one subscription that is eligible to contain resources. Given: ''."
        }
      ]
    }
  }
  --------------------------------------------------------------------------------

Confirmed az cli and able to list resources with no issues. However import process does not work. What else can I check? This is not for govt subscription.

magodo commented 9 months ago

There is a similar issue that you can check here: https://github.com/Azure/aztfexport/issues/385

sssd-dev commented 9 months ago

Thank you for the response. I had gone through the issue earlier. In my case, i had AZ context pointing to incorrect tenant.

sssd-dev commented 8 months ago

If you run into the error above, I was able to resolve the issue by using flag - --use-azure-cli-cred.