How to create a azure subscription using terraform

dinesh kumar 0 Reputation points
2023-03-08T12:32:16.25+00:00

I have a requirement to create multiple subscription from root_tenant using terraform. Is there a way to create subscriptions using terraform api??

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
3,578 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Carlos Solís Salazar 18,191 Reputation points MVP Volunteer Moderator
    2023-03-14T10:16:51.0066667+00:00

    Thank you for asking this question on the Microsoft Q&A Platform.

    According to the documentation, this is the code:

    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
    }
    
    

    Hope this helps!


    Accept Answer and Upvote, if any of the above helped, this thread can help others in the community looking for remediation for similar issues.

    NOTE: To answer you as quickly as possible, please mention me in your reply.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.