Pierre-Alexandre
Pierre-Alexandre

Reputation: 785

Azure Python SDK: Create budgets?

I am trying to create budgets on my Azure subscription. First of all. I tried to use Azure CLI to create budgets.

az consumption budget create --amount
                             --budget-name
                             --category {cost, usage}
                             --end-date
                             --start-date
                             --time-grain {annually, monthly, quarterly}

I got the following error as a response: Cost Management supports only Enterprise Agreement, Web direct and Microsoft Customer Agreement offer types. I was not able to figure out what was the issue but I guess it is because our organization is using Azure Sponsorship.

Then, I saw that Azure offers a budget REST API with a PUT request that looks like this:

https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget?api-version=2019-10-01

I am wondering if it's possible to create a budget using the Azure Python SDK? There is a documentation for the Python SDK billing but no examples.

Upvotes: 0

Views: 322

Answers (1)

Zeeshan Abbas
Zeeshan Abbas

Reputation: 42

Please try to use Pulumi - it's free for a single user: https://www.pulumi.com/docs/reference/pkg/azure-native/consumption/budget/

Other option is to use the Azure Arm templates: https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/quick-create-budget-template?tabs=CLI

Upvotes: 1

Related Questions