budgets
Creates, updates, deletes, gets or lists a budgets resource.
Overview
| Name | budgets |
| Type | Resource |
| Id | azure.cost_management.budgets |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
amount | number | The total amount of cost to track with the budget. Supported for CategoryType(s): Cost. Required for CategoryType(s): Cost. |
category | string | The category of the budget. * 'Cost' defines a Budget. * 'ReservationUtilization' defines a Reservation Utilization Alert Rule. Required. Known values are: "Cost" and "ReservationUtilization". (Cost, ReservationUtilization) |
currentSpend | object | The current amount of cost which is being tracked for a budget. Supported for CategoryType(s): Cost. |
eTag | string | eTag 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. |
filter | object | May be used to filter budgets by user-specified dimensions and/or tags. Supported for CategoryType(s): Cost, ReservationUtilization. |
forecastSpend | object | The forecasted cost which is being tracked for a budget. Supported for CategoryType(s): Cost. |
notifications | object | Dictionary 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. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
timeGrain | string | The 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) |
timePeriod | object | The 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. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
amount | number | The total amount of cost to track with the budget. Supported for CategoryType(s): Cost. Required for CategoryType(s): Cost. |
category | string | The category of the budget. * 'Cost' defines a Budget. * 'ReservationUtilization' defines a Reservation Utilization Alert Rule. Required. Known values are: "Cost" and "ReservationUtilization". (Cost, ReservationUtilization) |
currentSpend | object | The current amount of cost which is being tracked for a budget. Supported for CategoryType(s): Cost. |
eTag | string | eTag 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. |
filter | object | May be used to filter budgets by user-specified dimensions and/or tags. Supported for CategoryType(s): Cost, ReservationUtilization. |
forecastSpend | object | The forecasted cost which is being tracked for a budget. Supported for CategoryType(s): Cost. |
notifications | object | Dictionary 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. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
timeGrain | string | The 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) |
timePeriod | object | The 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. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | scope, budget_name | Gets the budget for the scope by budget name. | |
list | select | scope | $filter | Lists all budgets for the defined scope. |
create_or_update | insert | scope, budget_name | 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. | |
create_or_update | replace | scope, budget_name | 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. | |
delete | delete | scope, budget_name | The 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.
| Name | Datatype | Description |
|---|---|---|
budget_name | string | Budget Name. Required. |
scope | string | The fully qualified Azure Resource manager identifier of the resource. Required. |
$filter | string | OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. Default value is None. |
SELECT examples
- get
- list
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
;
Lists all budgets for the defined scope.
SELECT
id,
name,
amount,
category,
currentSpend,
eTag,
filter,
forecastSpend,
notifications,
systemData,
timeGrain,
timePeriod,
type
FROM azure.cost_management.budgets
WHERE scope = '{{ scope }}' -- required
AND $filter = '{{ $filter }}'
;
INSERT examples
- create_or_update
- Manifest
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
;
# Description fields are for documentation purposes
- name: budgets
props:
- name: scope
value: "{{ scope }}"
description: Required parameter for the budgets resource.
- name: budget_name
value: "{{ budget_name }}"
description: Required parameter for the budgets resource.
- name: properties
description: |
The properties of the budget.
value:
category: "{{ category }}"
amount: {{ amount }}
timeGrain: "{{ timeGrain }}"
timePeriod:
startDate: "{{ startDate }}"
endDate: "{{ endDate }}"
filter:
and:
- dimensions:
name: "{{ name }}"
operator: "{{ operator }}"
values:
- "{{ values }}"
tags:
name: "{{ name }}"
operator: "{{ operator }}"
values:
- "{{ values }}"
dimensions:
name: "{{ name }}"
operator: "{{ operator }}"
values:
- "{{ values }}"
tags:
name: "{{ name }}"
operator: "{{ operator }}"
values:
- "{{ values }}"
currentSpend:
amount: {{ amount }}
unit: "{{ unit }}"
notifications: "{{ notifications }}"
forecastSpend:
amount: {{ amount }}
unit: "{{ unit }}"
- name: eTag
value: "{{ eTag }}"
description: |
eTag 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.
REPLACE examples
- create_or_update
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
- delete
The operation to delete a budget.
DELETE FROM azure.cost_management.budgets
WHERE scope = '{{ scope }}' --required
AND budget_name = '{{ budget_name }}' --required
;