Skip to main content

budgets

Creates, updates, deletes, gets or lists a budgets resource.

Overview

Namebudgets
TypeResource
Idazure.consumption.budgets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
amountnumberThe total amount of cost to track with the budget. Required.
categorystringThe category of the budget, whether the budget tracks cost or usage. Required. "Cost" (Cost)
currentSpendobjectThe current amount of cost which is being tracked for a budget.
eTagstringeTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
filterobjectMay be used to filter budgets by user-specified dimensions and/or tags.
forecastSpendobjectThe forecasted cost which is being tracked for a budget.
notificationsobjectDictionary of notifications associated with the budget. Budget can have up to five notifications.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
timeGrainstringThe time covered by a budget. Tracking of the amount will be reset based on the time grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers. Required. Known values are: "Monthly", "Quarterly", "Annually", "BillingMonth", "BillingQuarter", and "BillingAnnual". (Monthly, Quarterly, Annually, BillingMonth, BillingQuarter, BillingAnnual)
timePeriodobjectHas start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than twelve months. Past start date should be selected within the timegrain period. There are no restrictions on the end date. Required.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectscope, budget_nameGets the budget for the scope by budget name.
listselectscopeLists all budgets for the defined scope.
create_or_updateinsertscope, budget_nameThe operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation.
create_or_updatereplacescope, budget_nameThe operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation.
deletedeletescope, budget_nameThe operation to delete a budget.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
budget_namestringBudget Name. Required.
scopestringThe fully qualified Azure Resource manager identifier of the resource. Required.

SELECT examples

Gets the budget for the scope by budget name.

SELECT
id,
name,
amount,
category,
currentSpend,
eTag,
filter,
forecastSpend,
notifications,
systemData,
timeGrain,
timePeriod,
type
FROM azure.consumption.budgets
WHERE scope = '{{ scope }}' -- required
AND budget_name = '{{ budget_name }}' -- required
;

INSERT examples

The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation.

INSERT INTO azure.consumption.budgets (
properties,
eTag,
scope,
budget_name
)
SELECT
'{{ properties }}',
'{{ eTag }}',
'{{ scope }}',
'{{ budget_name }}'
RETURNING
id,
name,
eTag,
properties,
systemData,
type
;

REPLACE examples

The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation.

REPLACE azure.consumption.budgets
SET
properties = '{{ properties }}',
eTag = '{{ eTag }}'
WHERE
scope = '{{ scope }}' --required
AND budget_name = '{{ budget_name }}' --required
RETURNING
id,
name,
eTag,
properties,
systemData,
type;

DELETE examples

The operation to delete a budget.

DELETE FROM azure.consumption.budgets
WHERE scope = '{{ scope }}' --required
AND budget_name = '{{ budget_name }}' --required
;