0

I am trying to run "terraform init" command using AZ CLI. Firstly it initialize the backend tfstorage container with tfstate files after that it is raising the error which is mentioned bellow.My az cli version is "2.38.0"

Error: Error building ARM Config: please ensure you have installed Azure CLI version 2.0.79 or newer. Error parsing json result from the Azure CLI: launching Azure CLI: exec: "az": executable file not found in %PATH%.**

Thanks in advance if somebody can rescue me

eku
  • 11
  • 1
  • 2
  • 6
  • 1
    The Azure CLI binary is not in your path on Windows. Have you downloaded and installed it on your PC? – Marko E Jul 18 '22 at 12:15
  • C:\Users\iktea>az version { "azure-cli": "2.38.0", "azure-cli-core": "2.38.0", "azure-cli-telemetry": "1.0.6", "extensions": {} } – eku Jul 18 '22 at 13:17
  • Is it the same user as the one that installed the AZ CLI? – Marko E Jul 18 '22 at 13:34

2 Answers2

0

Navigate to the project directory path using power shell and run the command on the power shell.

C:\Users\abc\IdeaProjects\test_devopspipeline\terraform-manifest> $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

Reference: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest&tabs=azure-powershell

eku
  • 11
  • 1
  • 2
  • 6
0

I was getting this error too, in my case it was a simply that when I ran this

    Provider "azurerm" {
  subscription_id = "${var.subscription_id}"
  tenant_id       = "${var.tenant_id}"
  client_id       = "${var.client_Id}"
  client_secret   = "${var.client_secret}"
  features {}
}

Terraform was not able to capture those values from the .tfvars file, In my particular case, it was a typo on client_Id => (Id) is meant to be id. If you want to set these variables from outside of the .tf files you can check this link out