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?

6

1 Answer

Tested in my environment getting the same error when i haven't connected with any active account.

enter image description here

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 

enter image description here

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.