0

When I run Terraform Plan I am getting the following error message.

Error building AzureRM Client: Error populating Client ID from the Azure CLI: No Authorization Tokens were found

I ran 'az login' to log in and 'az account set --subscription' to set the right subscription.

I saw other postings and tried running 'az account get-access-token' and it returns the accessToken without any errors.

terraform {
  # backend "azurerm" {
  #   key = "terraform.tfstate"
  # }
  required_version = ">= 0.12"
}

provider "azurerm" {
  
  version                    = "= 1.31.0"
  skip_provider_registration = true
}

Terraform and Az cli versions below

 $ az --version azure-cli                         2.38.0



$ terraform --version
Terraform v0.12.31
+ provider.azurerm v1.31.0

1 Answers1

0

Error building AzureRM Client: Error populating Client ID from the Azure CLI: No Authorization Tokens were found

This Error occurs due to versions of Terraform azurerm providers and CLI. The authentication was switched over by Azure from ADAL to MSAL. If you are using recent version of Azure CLI with older version of Terraform's Azurerm this may cause an authentication failure and error.

To fix this issues use the upgraded versions both azure cli and terrform azurerm providers.

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.0.0"
    }
  }
}

# Configure the Microsoft Azure Provider
provider "azurerm" {
  features {}
}

Terraform azurerm version link

Similar kind of error also solved,you can check this SO thread by Ansuman Bal.

Venkatesan
  • 3,748
  • 1
  • 3
  • 15