Skip to main content

budgets

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

Overview

Namebudgets
TypeResource
Idazure.cost_management.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. Supported for CategoryType(s): Cost. Required for CategoryType(s): Cost.
categorystringThe category of the budget. * 'Cost' defines a Budget. * 'ReservationUtilization' defines a Reservation Utilization Alert Rule. Required. Known values are: "Cost" and "ReservationUtilization". (Cost, ReservationUtilization)
currentSpendobjectThe current amount of cost which is being tracked for a budget. Supported for CategoryType(s): Cost.
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. Supported for CategoryType(s): Cost, ReservationUtilization.
forecastSpendobjectThe forecasted cost which is being tracked for a budget. Supported for CategoryType(s): Cost.
notificationsobjectDictionary of notifications associated with the budget. Supported for CategoryType(s): Cost, ReservationUtilization. * Constraints for CategoryType: Cost - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications with thresholdType: Forecasted. * Constraints for CategoryType: ReservationUtilization - Only one notification allowed. thresholdType is not applicable.
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. Supported for CategoryType(s): Cost, ReservationUtilization. Supported timeGrainTypes for CategoryType: Cost * Monthly * Quarterly * Annually * BillingMonth* * BillingQuarter* * BillingAnnual* *only supported for Web Direct customers. Supported timeGrainTypes for CategoryType: ReservationUtilization * Last7Days * Last30Days Required for CategoryType(s): Cost, ReservationUtilization. Required. Known values are: "Monthly", "Quarterly", "Annually", "BillingMonth", "BillingQuarter", "BillingAnnual", "Last7Days", and "Last30Days". (Monthly, Quarterly, Annually, BillingMonth, BillingQuarter, BillingAnnual, Last7Days, Last30Days)
timePeriodobjectThe time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. Supported for CategoryType(s): Cost, ReservationUtilization. Required for CategoryType(s): Cost, ReservationUtilization. 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.
listselectscope$filterLists 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.
$filterstringOData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. Default value is None.

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.cost_management.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.cost_management.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.cost_management.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.cost_management.budgets
WHERE scope = '{{ scope }}' --required
AND budget_name = '{{ budget_name }}' --required
;