title: AZURE Terraform Service Principal authentication Error
body: <p>I am trying to authenticate azure by using a service principle and a client secret using terraform scripts.</p>
  <p>This my main.tf file</p>
  <pre><code># Configure the Azure provider
  provider &quot;azuread&quot; {
    version = &quot;~&gt;0.8&quot;
  }
  
  provider &quot;azurerm&quot; {
    subscription_id = &quot;mysubscription_id&quot;
    client_id       = &quot;myclient_id&quot;
    client_secret   = &quot;myclient_secret&quot;
    tenant_id       = &quot;mytenant_id&quot;
    version         = &quot;2.0.0&quot;
    features {}
  }
  
  resource &quot;azurerm_resource_group&quot; &quot;rg&quot; {
    name     = &quot;aks-resource-group&quot;
    location = &quot;West Europe&quot;
  }
  </code></pre>
  <p>But error comes like this</p>
  <pre><code>│ Error: Error building account: Error getting authenticated object ID: Error listing Service Principals: autorest.DetailedError{Original:adal.tokenRefreshError{message:&quot;adal: Refresh request failed. Status Code = '401'. Response body: {\&quot;error\&quot;:\&quot;invalid_client\&quot;,\&quot;error_description\&quot;:\&quot;AADSTS7000215: Invalid client secret is provided.\\r\\nTrace ID: 4f5e5cf8-0892-4d5e-8ac7-7646d91c2d00\\r\\nCorrelation ID: 5b25c027-0a8f-4c2f-a5d0-05a169afde02\\r\\nTimestamp: 2021-09-16 12:01:26Z\&quot;,\&quot;error_codes\&quot;:[7000215],\&quot;timestamp\&quot;:\&quot;2021-09-16 12:01:26Z\&quot;,\&quot;trace_id\&quot;:\&quot;4f5e5cf8-0892-4d5e-8ac7-7646d91c2d00\&quot;,\&quot;correlation_id\&quot;:\&quot;5b25c027-0a8f-4c2f-a5d0-05a169afde02\&quot;,\&quot;error_uri\&quot;:\&quot;https://login.microsoftonline.com/error?code=7000215\&quot;}&quot;, resp:(*http.Response)(0xc0007aa000)}, PackageType:&quot;azure.BearerAuthorizer&quot;, Method:&quot;WithAuthorization&quot;, StatusCode:401, Message:&quot;Failed to refresh the Token for request to https://graph.windows.net/9ff0ada9-0070-48c3-bbdf-2655fe1387e6/servicePrincipals?%24filter=appId+eq+%278a10de4a-2cf6-42f6-91ca-7fc93ce89a5b%27&amp;api-version=1.6&quot;, ServiceError:[]uint8(nil), Response:(*http.Response)(0xc0007aa000)}
  │
  │   with provider[&quot;registry.terraform.io/hashicorp/azurerm&quot;],
  │   on main.tf line 6, in provider &quot;azurerm&quot;:
  │    6: provider &quot;azurerm&quot; {
  </code></pre>
  <p>My locally installed terraform version is <code>Terraform v1.0.5</code>. My local azure version is</p>
  <pre><code>{
    &quot;azure-cli&quot;: &quot;2.27.2&quot;,
    &quot;azure-cli-core&quot;: &quot;2.27.2&quot;,
    &quot;azure-cli-telemetry&quot;: &quot;1.0.6&quot;,
    &quot;extensions&quot;: {}
  }
  </code></pre>
  <p>what is the reason for that</p>