budgets
Creates, updates, deletes, gets or lists a budgets resource.
Overview
| Name | budgets |
| Type | Resource |
| Id | azure.consumption.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. Required. |
category | string | The category of the budget, whether the budget tracks cost or usage. Required. "Cost" (Cost) |
currentSpend | object | The current amount of cost which is being tracked for a budget. |
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. |
forecastSpend | object | The forecasted cost which is being tracked for a budget. |
notifications | object | Dictionary of notifications associated with the budget. Budget can have up to five notifications. |
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. 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) |
timePeriod | object | Has 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. |
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. Required. |
category | string | The category of the budget, whether the budget tracks cost or usage. Required. "Cost" (Cost) |
currentSpend | object | The current amount of cost which is being tracked for a budget. |
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. |
forecastSpend | object | The forecasted cost which is being tracked for a budget. |
notifications | object | Dictionary of notifications associated with the budget. Budget can have up to five notifications. |
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. 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) |
timePeriod | object | Has 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. |
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 | 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. |
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.consumption.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.consumption.budgets
WHERE scope = '{{ scope }}' -- required
;
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.consumption.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.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
- delete
The operation to delete a budget.
DELETE FROM azure.consumption.budgets
WHERE scope = '{{ scope }}' --required
AND budget_name = '{{ budget_name }}' --required
;