Help with Azure create RG with Terraform

Hi All

I am newbie and would apricate any help you can provide, my setup

Using Visual Code
Installed Module azure Account, Azure CLI, Azure Terraform, Hasicom, PowerrShell
Have a Free tier Azure Sub
On the PC created Environment variable i.e TF_VAR_clientid…, sub_id, tenant id…
The code i am trying just to create a simple RG in Azure is

variable “client_id” {}
variable “tenant_id” {}
variable “client_secret” {}
variable “subscription_id” {}

terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “2.36.0”
client_id = “var.client_id”
tenant_id = “var.tenant_id”
client_secret = “var.client_id”
subscription_id = “var.subscription_id”
}
}
}

provider “azurerm” {
features {}
}

resource “azurerm_resource_group” “test_server_rg” {
name = “test-rg”
location = “westus2”
}

Noticed my variable di not auto populate maybe i have the wrong extension, the error i get when i run Terraform plan is

Error: Error building AzureRM Client: obtain subscription() from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1: Please run ‘az login’ to setup account.

on Azure_RG.tf line 19, in provider “azurerm”:
19: provider “azurerm” {

Pls help

Thank you

You haven’t done , App Registration properly .
Obtain CLIENT ID and SCCERT and Pass It Variable Section , Those are sensitive data. Once you configured Properly there is no need to login through CLI . Below links helps