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

401 Unauthorized #512

Closed akamalov closed 6 months ago

akamalov commented 6 months ago

Environment

Mac M1 Pro (Sonoma)
aztfexport version v0.14.0(fb772ba)

Attempting to execute:

aztfexport resource-group test-001

Getting the following error:

  POST https://login.microsoftonline.com/b3fddaa6-c66f-4dc6-acec-aee02fd27d25/oauth2/v2.0/token
  --------------------------------------------------------------------------------
  RESPONSE 401 Unauthorized
  --------------------------------------------------------------------------------
  {
    "error": "invalid_client",
    "error_description": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app
  '04ccb8e0-923e-487f-86ee-9ba51d700255'. Trace ID: 23069fcb-77b6-4ed1-9654-0578f9bd1700 Correlation ID: 3a48c776-1bc0-4a38-9d13-98db7426089f Timestamp: 2024-03-29 19:20:46Z",
    "error_codes": [
      7000215
    ],
    "timestamp": "2024-03-29 19:20:46Z",
    "trace_id": "23069fcb-77b6-4ed1-9654-0578f9bd1700",
    "correlation_id": "3a48c776-1bc0-4a38-9d13-98db7426089f",
    "error_uri": "https://login.microsoftonline.com/error?code=7000215"

I double check client secret ID, it has not expired. I can create/query/delete resources as I wish under this account. I even elevated my privilege to Owner, but getting the same error.

akamalov commented 6 months ago

I had to use explicit credentials such as aztfexport resource-group -s <subscriptio_id> --use-azure-cli-cred test-001