Skip to content

Commit 1630c8c

Browse files
authored
Merge pull request #175090 from bandersmsft/cmb-automation
CM+B - Automation updates
2 parents 9bdd5df + 5ec3900 commit 1630c8c

29 files changed

+2458
-192
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
title: Automate budget creation
3+
titleSuffix: Microsoft Cost Management
4+
description: This article helps you create budgets with the Budget API and a budget template.
5+
author: bandersmsft
6+
ms.author: banders
7+
ms.date: 07/15/2022
8+
ms.topic: conceptual
9+
ms.service: cost-management-billing
10+
ms.subservice: cost-management
11+
ms.reviewer: adwise
12+
---
13+
14+
# Automate budget creation
15+
16+
You can automate budget creation using the [Budgets API](/rest/api/consumption/budgets). You can also create a budget with a [budget template](../costs/quick-create-budget-template.md). Templates are an easy way for you to standardize Azure deployments while ensuring cost control is properly configured and enforced.
17+
18+
## Common Budgets API configurations
19+
20+
There are many ways to configure a budget in your Azure environment. Consider your scenario first and then identify the configuration options that enable it. Review the following options:
21+
22+
- **Time Grain** - Represents the recurring period your budget uses to accrue and evaluate costs. The most common options are Monthly, Quarterly, and Annual.
23+
- **Time Period** - Represents how long your budget is valid. The budget actively monitors and alerts you only while it remains valid.
24+
- **Notifications**
25+
- Contact Emails – The email addresses receive alerts when a budget accrues costs and exceeds defined thresholds.
26+
- Contact Roles - All users who have a matching Azure role on the given scope receive email alerts with this option. For example, Subscription Owners could receive an alert for a budget created at the subscription scope.
27+
- Contact Groups - The budget calls the configured action groups when an alert threshold is exceeded.
28+
- **Cost dimension filters** - The same filtering you can do in Cost Analysis or the Query API can also be done on your budget. Use this filter to reduce the range of costs that you're monitoring with the budget.
29+
30+
After you've identified the budget creation options that meet your needs, create the budget using the API. The example below helps get you started with a common budget configuration.
31+
32+
### Create a budget filtered to multiple resources and tags
33+
34+
Request URL: `PUT https://management.azure.com/subscriptions/{SubscriptionId}/providers/Microsoft.Consumption/budgets/{BudgetName}/?api-version=2019-10-01`
35+
36+
```json
37+
{
38+
"eTag": "\"1d34d016a593709\"",
39+
"properties": {
40+
"category": "Cost",
41+
"amount": 100.65,
42+
"timeGrain": "Monthly",
43+
"timePeriod": {
44+
"startDate": "2017-10-01T00:00:00Z",
45+
"endDate": "2018-10-31T00:00:00Z"
46+
},
47+
"filter": {
48+
"and": [
49+
{
50+
"dimensions": {
51+
"name": "ResourceId",
52+
"operator": "In",
53+
"values": [
54+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{meterName}",
55+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{meterName}"
56+
]
57+
}
58+
},
59+
{
60+
"tags": {
61+
"name": "category",
62+
"operator": "In",
63+
"values": [
64+
"Dev",
65+
"Prod"
66+
]
67+
}
68+
},
69+
{
70+
"tags": {
71+
"name": "department",
72+
"operator": "In",
73+
"values": [
74+
"engineering",
75+
"sales"
76+
]
77+
}
78+
}
79+
]
80+
},
81+
"notifications": {
82+
"Actual_GreaterThan_80_Percent": {
83+
"enabled": true,
84+
"operator": "GreaterThan",
85+
"threshold": 80,
86+
"contactEmails": [
87+
88+
89+
],
90+
"contactRoles": [
91+
"Contributor",
92+
"Reader"
93+
],
94+
"contactGroups": [
95+
"/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}
96+
],
97+
"thresholdType": "Actual"
98+
}
99+
}
100+
}
101+
}
102+
```
103+
104+
## Supported locales for budget alert emails
105+
106+
With budgets, you're alerted when costs cross a set threshold. You can set up to five email recipients per budget. Recipients receive the email alerts within 24 hours of crossing the budget threshold. However, your recipient might need to receive an email in a different language. You can use the following language culture codes with the Budgets API. Set the culture code with the `locale` parameter similar to the following example.
107+
108+
```json
109+
{
110+
"eTag": "\"1d681a8fc67f77a\"",
111+
"properties": {
112+
"timePeriod": {
113+
"startDate": "2020-07-24T00:00:00Z",
114+
"endDate": "2022-07-23T00:00:00Z"
115+
},
116+
"timeGrain": "BillingMonth",
117+
"amount": 1,
118+
"currentSpend": {
119+
"amount": 0,
120+
"unit": "USD"
121+
},
122+
"category": "Cost",
123+
"notifications": {
124+
"actual_GreaterThan_10_Percent": {
125+
"enabled": true,
126+
"operator": "GreaterThan",
127+
"threshold": 20,
128+
"locale": "en-us",
129+
"contactEmails": [
130+
131+
],
132+
"contactRoles": [],
133+
"contactGroups": [],
134+
"thresholdType": "Actual"
135+
}
136+
}
137+
}
138+
}
139+
```
140+
141+
Languages supported by a culture code:
142+
143+
| Culture code| Language |
144+
| --- | --- |
145+
| en-us | English (United States) |
146+
| ja-jp | Japanese (Japan) |
147+
| zh-cn | Chinese (Simplified, China) |
148+
| de-de | German (Germany) |
149+
| es-es | Spanish (Spain, International) |
150+
| fr-fr | French (France) |
151+
| it-it | Italian (Italy) |
152+
| ko-kr | Korean (Korea) |
153+
| pt-br | Portuguese (Brazil) |
154+
| ru-ru | Russian (Russia) |
155+
| zh-tw | Chinese (Traditional, Taiwan) |
156+
| cs-cz | Czech (Czech Republic) |
157+
| pl-pl | Polish (Poland) |
158+
| tr-tr | Turkish (Turkey) |
159+
| da-dk | Danish (Denmark) |
160+
| en-gb | English (United Kingdom) |
161+
| hu-hu | Hungarian (Hungary) |
162+
| nb-no | Norwegian Bokmal (Norway) |
163+
| nl-nl | Dutch (Netherlands) |
164+
| pt-pt | Portuguese (Portugal) |
165+
| sv-se | Swedish (Sweden) |
166+
167+
## Configure cost-based orchestration for budget alerts
168+
169+
You can configure budgets to start automated actions using Azure Action Groups. To learn more about automating actions using budgets, see [Automation with Azure Budgets](../manage/cost-management-budget-scenario.md).
170+
171+
## Next steps
172+
173+
- Learn more about Cost Management + Billing automation at [Cost Management automation overview](automation-overview.md).
174+
- [Assign permissions to Cost Management APIs](cost-management-api-permissions.md).
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: Microsoft Cost Management automation FAQ
3+
description: This FAQ is a list of frequently asked questions and answers about Cost Management automation.
4+
author: bandersmsft
5+
ms.author: banders
6+
ms.date: 07/15/2022
7+
ms.topic: conceptual
8+
ms.service: cost-management-billing
9+
ms.subservice: cost-management
10+
ms.reviewer: adwise
11+
---
12+
13+
# Cost Management automation FAQ
14+
15+
The following sections cover the most commonly asked questions and answers about Cost Management automation.
16+
17+
### What are Cost Details versus Usage Details?
18+
19+
Both are different names for the same dataset. Usage Details is the original name of the dataset back when only Azure consumption resource usage records were present. Over time, more types of cost have been added to the dataset, including marketplace usage, Azure purchases (such as Reservations), marketplace purchases and even Microsoft 365 costs. Cost Details is the name being used moving forward for the dataset.
20+
21+
### Why do I get Usage Details API timeouts?
22+
23+
Cost datasets available from the Usage Details API can often be overly large (multiple GBs or more). The larger the size of the dataset that you request, the longer the service takes to compile the data before sending it to you. Because of the delay, synchronous API solutions like the paginated [JSON Usage Details API](/rest/api/consumption/usage-details/list) might time out before your data is provided. If you encounter timeouts or have processes that frequently need to pull a large amount of cost data, see [Retrieve large cost datasets recurringly with Exports](../costs/tutorial-export-acm-data.md).
24+
25+
### What is the difference between legacy and modern usage details?
26+
27+
A legacy versus modern usage details record is identified by the kind field in the [Usage Details API](/rest/api/consumption/usage-details/list). The field is used to distinguish between data that’s returned for different customer types. The call patterns to obtain legacy and modern usage details are essentially the same. The granularity of the data is the same. The main difference is the fields available in the usage details records themselves. If you’re an EA customer, you’ll always get legacy usage details records. If you’re a Microsoft Customer Agreement customer, you'll always get modern usage details records.
28+
29+
### How do I see my recurring charges?
30+
31+
Recurring charges are available in the [Cost Details](/rest/api/cost-management/generate-cost-details-report) report when viewing Actual Cost.
32+
33+
### Where can I see tax information in Cost Details?
34+
35+
Cost details data is all pre-tax. Tax related charges are only available on your invoice.
36+
37+
### Why is PAYGPrice zero in my cost details file?
38+
39+
If you’re an EA customer, we don’t currently support showing pay-as-you-go prices directly in the usage details data. To see the pricing, use the [Retail Prices API](/rest/api/cost-management/retail-prices/azure-retail-prices).
40+
41+
### Does Cost Details have Reservation charges?
42+
43+
Yes it does. You can see those charges according to when the actual charges occurred (Actual Cost). Or, you can see the charges spread across the resources that consumed the Reservation (Amortized Cost). For more information, see [Get Azure consumption and reservation usage data using API](../reservations/understand-reserved-instance-usage-ea.md#get-azure-consumption-and-reservation-usage-data-using-api).
44+
45+
### Am I charged for using the Cost Details API?
46+
47+
No the Cost Details API is free. Make sure to abide by the rate-limiting policies, however.
48+
49+
<!--- For more information, see [Data latency and rate limits](api-latency-rate-limits.md). -->
50+
51+
### What's the difference between the Invoice API, the Transaction API, and the Cost Details API?
52+
53+
These APIs provide a different view of the same data:
54+
55+
- The [Invoice API](/api/billing/2019-10-01-preview/invoices) provides an aggregated view of your monthly charges.
56+
- The [Transactions API](/rest/api/billing/2020-05-01/transactions/list-by-invoice) provides a view of your monthly charges aggregated at product/service family level.
57+
- The [Cost Details](/rest/api/cost-management/generate-cost-details-report) report provides a granular view of the usage and cost records for each day. Both Enterprise and Microsoft Customer Agreement customers can use it. If you're a legacy pay-as-you-go customer, see [Get Cost Details as a legacy customer](get-usage-details-legacy-customer.md).
58+
59+
### I recently migrated from an EA to an MCA agreement. How do I migrate my API workloads?
60+
61+
See [Migrate from EA to MCA APIs](../costs/migrate-cost-management-api.md).
62+
63+
### When will the [Enterprise Reporting APIs](../manage/enterprise-api.md) get turned off?
64+
65+
The Enterprise Reporting APIs are deprecated. The date that the API will be turned off is still being determined. We recommend that you migrate away from the APIs as soon as possible. For more information, see [Migrate from Enterprise Reporting to Azure Resource Manager APIs](../costs/migrate-from-enterprise-reporting-to-azure-resource-manager-apis.md).
66+
67+
### When will the [Consumption Usage Details API](/rest/api/consumption/usage-details/list) get turned off?
68+
69+
The Consumption Usage Details API is deprecated. The date that the API will bet turned off is still being determined. We recommend that you migrate away from the API as soon as possible. For more information, see [Migrate from Consumption Usage Details API](migrate-consumption-usage-details-api.md).
70+
71+
### When will the [Consumption Marketplaces API](/rest/api/consumption/marketplaces/list) get turned off?
72+
73+
The Marketplaces API is deprecated. The date that the API will be turned off is still being determined. Data from the API is available in the [Cost Details](/rest/api/cost-management/generate-cost-details-report) report. We recommend that you migrate to it as soon as possible. For more information, see [Migrate from Consumption Marketplaces API](migrate-consumption-marketplaces-api.md).
74+
75+
### When will the [Consumption Forecasts API](/rest/api/consumption/forecasts/list) get turned off?
76+
77+
The Forecasts API is deprecated. The date that the API will be turned off is still being determined. Data from the API is available in the [Cost Management Forecast API](/rest/api/cost-management/forecast). We recommend that you migrate to it as soon as possible.
78+
79+
## Next steps
80+
81+
- Learn more about Cost Management + Billing automation at [Cost Management automation overview](automation-overview.md).

0 commit comments

Comments
 (0)