providers.tf
terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "~>2.0" } }
}
provider "azurerm" { features {}
}terraform version: Terraform v1.1.7
terraform command: terraform plan
CLI Error:
Error: building AzureRM Client: obtain subscription(XXXXXXXX-XXXX-XXXX-XXX-XXXXXXXXXXXX) from Azure CLI: parsing json result from the Azure CLI: waiting for the Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account. with provider[""], on providers.tf line 10, in provider "azurerm": 10: provider "azurerm" {I did run az login and signed into my Azure account.
Question:
I can't find out what I'm doing wrong?
61 Answer
Tested in my environment getting the same error when i haven't connected with any active account.
As Suggested by cdub is correct , Tried running az logout multiple times until you see There are no active accounts, running az login, az account set -s <your-subscription-name>, then re-running terraform init and finally, terraform plan
#get the current default subscription using show
az account show --output table 0