Error: building AzureAD Client: obtain subscription ... Error waiting for the Azure CLI

This can be reproduced with only 2 files:

backends.tf

# Using multiple workspaces:
terraform {
  backend "remote" {
    hostname = "app.terraform.io"
    organization = "my-company"

    workspaces {
      prefix = "vault-identity-"
    }
  }
}

providers.tf

# Configure the Azure AD Provider
provider "azuread" {
  version = "~> 1.0.0"

  # NOTE: This relies on authentication via the Azure CLI.
  # see here for more info: https://terraform.io/docs/providers/azuread/

  tenant_id = "4c69d615-9554-4839-8aac-07898be2c4ac"
}

# Retrieve domain information
data "azuread_domains" "maindomain" {
  only_initial = true
}

The error I run into, after successful authentication with az login --tenant $TENANT_ID, is as follows:

vault-identity[develop !?]$ terraform plan azure-ad-oidc
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


Error: building AzureAD Client: obtain subscription(a0496e39-63e6-4ab6-a1e1-2cdbc77582d2) from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1

  on azure-ad-oidc/providers.tf line 2, in provider "azuread":
   2: provider "azuread" {

The above output reflects running this with local execution, but I also got stuck on the same crap when I tried remote execution.

I mean, a parsing error? What is that supposed to mean? Is there any way I could even see what it was even trying to parse?

Update: I’ve made a GitHub issue here: