{"record":{"id":"a27b58db62a25b0f","repo":"hashicorp/terraform","slug":"building-storage-accounts-client-v","errorCode":null,"errorMessage":"building Storage Accounts client: %+v","messagePattern":"building Storage Accounts client: %\\+v","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/azure/api_client.go","lineNumber":98,"sourceCode":"\t\t}\n\n\t\t// When using Azure CLI to auth, the user can leave the \"subscription_id\" unspecified. In this case the subscription id is inferred from\n\t\t// the Azure CLI default subscription.\n\t\tif config.SubscriptionID == \"\" {\n\t\t\tif cachedAuth, ok := resourceManagerAuth.(*auth.CachedAuthorizer); ok {\n\t\t\t\tif cliAuth, ok := cachedAuth.Source.(*auth.AzureCliAuthorizer); ok && cliAuth.DefaultSubscriptionID != \"\" {\n\t\t\t\t\tconfig.SubscriptionID = cliAuth.DefaultSubscriptionID\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif config.SubscriptionID == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"subscription id not specified\")\n\t\t}\n\n\t\t// Setup the SA client.\n\t\tclient.storageAccountsClient, err = storageaccounts.NewStorageAccountsClientWithBaseURI(config.AuthConfig.Environment.ResourceManager)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"building Storage Accounts client: %+v\", err)\n\t\t}\n\t\tclient.configureClient(client.storageAccountsClient.Client, resourceManagerAuth)\n\n\t\t// Populating the storage account detail\n\t\tstorageAccountId := commonids.NewStorageAccountID(config.SubscriptionID, config.ResourceGroupName, client.storageAccountName)\n\t\tresp, err := client.storageAccountsClient.GetProperties(ctx, storageAccountId, storageaccounts.DefaultGetPropertiesOperationOptions())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"retrieving %s: %+v\", storageAccountId, err)\n\t\t}\n\t\tif resp.Model == nil {\n\t\t\treturn nil, fmt.Errorf(\"retrieving %s: model was nil\", storageAccountId)\n\t\t}\n\t\tclient.accountDetail, err = populateAccountDetails(storageAccountId, *resp.Model)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"populating details for %s: %+v\", storageAccountId, err)\n\t\t}\n\t}\n","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/azure/api_client.go#L80-L116","documentation":"Returned by buildClient when storageaccounts.NewStorageAccountsClientWithBaseURI fails for the configured Azure environment's ResourceManager endpoint. This is a low-level SDK client construction failure, typically because the environment's ResourceManager base URI is invalid or the SDK cannot initialize against it.","triggerScenarios":"ARM auth succeeded but constructing the Storage Accounts management client with the environment's ResourceManager base URI errors. Triggered during terraform init when the backend needs the ARM storage client (to look up the blob endpoint or list keys).","commonSituations":"Custom/airgapped cloud environment with a malformed ResourceManager endpoint; misconfigured environment_name pointing at an environment whose metadata is incomplete; SDK version incompatibility parsing the endpoint URL.","solutions":["Verify environment_name / ARM_ENVIRONMENT points to a valid, complete Azure environment definition.","For airgapped/custom clouds, ensure the environment metadata's ResourceManager endpoint is a valid absolute URL.","Switch to a well-known environment (public, usgovernment, china) if a custom one is misconfigured."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the environment metadata before building the client.\nif config.AuthConfig.Environment.ResourceManager == (environments.Api{}) {\n    return errors.New(\"environment has no ResourceManager endpoint; check environment_name\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a known environment_name (public, usgovernment, china) unless a custom cloud is verified.","For custom clouds, validate all endpoints (ResourceManager, Storage) are populated and absolute.","Test backend init against the target environment in a staging subscription first."],"tags":["azure","backend","client-construction","environment","resource-manager","terraform"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}