Hi
I’m getting the following error when trying to run terraform init using Az CLI in Azure GCC High. I am trying to store my tfstate in another subscription and deploy resource into another - both subs are in the same tenant. I’ve had success with the below terraform{} provider{} in commercial so I’m stumped!
Initializing the backend… ╷ │ Error: Failed to get existing workspaces: Error retrieving keys for Storage Account “storageaccount”: storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=404 – Original Error: autorest/azure: Service returned an error. Status=404 Code=“SubscriptionNotFound” Message=“The subscription ‘’ could not be found.”
I’ve cleared the .azure folder and switched to USGovernment using az cloud set --name AzureUSGovernment then az login. When az login completes, I see all the subscriptions I have oadmin to and & are visible and enabled in the output.
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.27.0"
}
}
backend "azurerm" {
subscription_id = "<Subscription A GUID>"
tenant_id = "<Tenant GUID>"
resource_group_name = "rg-demo"
storage_account_name = "storagename"
container_name = "tfstate"
key = "env/state.tfstate"
}
}
provider "azurerm" {
features {}
subscription_id = <Subscription B GUID>
tenant_id = <Tenant GUID>
}
Thanks in advance,
Brad.