I get this error running a "terraform plan". I authenticated terraform to Azure via CLI. I have set up an account subscription. How can I solve this problem?
Error: building AzureRM Client: 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%.
2
Answers
The error says that az is not found. So for this type of error simple way out is logging-in into Azure like below:
Then the error goes:
And then you can check your subscriptions once like below:
And following login step i got resolved my problem.
And also check if you are using latest Azure Cli version.
And also try the below command:
References taken from:
Terraform cloud needs an Azure access since your plan is running on the cloud.
First, you need to create a service principal for azure
See this tutorial: https://developer.hashicorp.com/terraform/tutorials/azure-get-started/azure-build
After service principal is created, you get this in response:
Then you can provide azure access for terraform using one of these methods:
Hovever it’s not a good idea to sotre sensitive data in config.
That’s why you may use method #3:
See this answer for details:
https://discuss.hashicorp.com/t/using-the-azure-provider-with-terraform-cloud/18177/2