Using the same service connection in CLI script, new subscription is created but when I try to create using Terraform, it said,
Error: creating new Subscription (Alias “*******************”): subscription.AliasClient#Create: Failure sending request: StatusCode=401 – Original Error: Code=“UserNotAuthorized” Message=“User is not authorized to create subscriptions on this enrollment account”
Terraform Version
1.1.6
AzureRM Provider Version
3.46.0
script ref
data “azurerm_billing_enrollment_account_scope” “example” {
billing_account_name = “1234567890”
enrollment_account_name = “0123456”
}
resource “azurerm_subscription” “example” {
subscription_name = “My Example EA Subscription”
billing_scope_id = data.azurerm_billing_enrollment_account_scope.example.id
}