You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cost-management-billing/automate/get-small-usage-datasets-on-demand.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ titleSuffix: Microsoft Cost Management
4
4
description: The article explains how you can use the Cost Details API to get raw, unaggregated cost data that corresponds to your Azure bill.
5
5
author: bandersmsft
6
6
ms.author: banders
7
-
ms.date: 11/17/2023
7
+
ms.date: 01/24/2024
8
8
ms.topic: conceptual
9
9
ms.service: cost-management-billing
10
10
ms.subservice: cost-management
@@ -13,13 +13,13 @@ ms.reviewer: jojoh
13
13
14
14
# Get small cost datasets on demand
15
15
16
-
Use the [Cost Details](/rest/api/cost-management/generate-cost-details-report) API to get raw, unaggregated cost data that corresponds to your Azure bill. The API is useful when your organization needs a programmatic data retrieval solution. Consider using the API if want to analyze smaller cost data sets of 2 GB (2 million rows) or less. However, you should use Exports for ongoing data ingestion workloads and for the download of larger datasets.
16
+
Use the [Cost Details](/rest/api/cost-management/generate-cost-details-report) API to get raw, unaggregated cost data that corresponds to your Azure bill. The API is useful when your organization needs a programmatic data retrieval solution. Consider using the API if you want to analyze smaller cost data sets of 2 GB (2 million rows) or less. However, you should use Exports for ongoing data ingestion workloads and for the download of larger datasets.
17
17
18
18
If you want to get large amounts of exported data regularly, see [Retrieve large cost datasets recurringly with exports](../costs/ingest-azure-usage-at-scale.md).
19
19
20
20
To learn more about the data in cost details (formerly referred to as *usage details*), see [Ingest cost details data](automation-ingest-usage-details-overview.md).
21
21
22
-
The [Cost Details](/rest/api/cost-management/generate-cost-details-report) report is only available for customers with an Enterprise Agreement or Microsoft Customer Agreement. If you're an MSDN, Pay-As-You-Go or Visual Studio customer, see [Get cost details for a pay-as-you-go subscription](get-usage-details-legacy-customer.md).
22
+
The [Cost Details](/rest/api/cost-management/generate-cost-details-report) report is only available for customers with an Enterprise Agreement or Microsoft Customer Agreement. If you're an MSDN, pay-as-you-go or Visual Studio customer, see [Get cost details for a pay-as-you-go subscription](get-usage-details-legacy-customer.md).
23
23
24
24
## Permissions
25
25
@@ -40,7 +40,7 @@ Microsoft recommends the following best practices as you use the Cost Details AP
40
40
41
41
### Request schedule
42
42
43
-
If you want to get the latest cost data, we recommend you query at most once per day. Reports are refreshed every four hours. If you call more frequently, you'll receive identical data. Once you download your cost data for historical invoices, the charges won't change unless you're explicitly notified. We recommend caching your cost data in a queryable store on your side to prevent repeated calls for identical data.
43
+
If you want to get the latest cost data, we recommend you query at most once per day. Reports are refreshed every four hours. If you call more frequently, you receive identical data. Once you download your cost data for historical invoices, the charges don't change unless you're explicitly notified. We recommend caching your cost data in a queryable store on your side to prevent repeated calls for identical data.
44
44
45
45
### Chunk your requests
46
46
@@ -56,13 +56,13 @@ On demand calls to the API are rate limited. The time it takes to generate your
56
56
57
57
### Supported dataset time ranges
58
58
59
-
The Cost Details API supports a maximum data set time range of one month per report. Historical data can be retrieved for up to 13 months back from the current date. If you're looking to seed a 13month historical dataset, we recommend placing 13 calls for one month datasets going back 13 months.
59
+
The Cost Details API supports a maximum data set time range of one month per report. Historical data can be retrieved for up to 13 months before the current date. If you want to seed a 13-month historical dataset, we recommend placing 13 calls in one month datasets for the past 13 months. To retrieve historical data that is older than 13 months, use the [Exports REST API](/rest/api/cost-management/exports).
60
60
61
61
## Example Cost Details API requests
62
62
63
-
The following example requests are used by Microsoft customers to address common scenarios. The data that's returned by the request corresponds to the date when the cost was received by the billing system. It might include costs from multiple invoices. It's an asynchronous API. As such, you place an initial call to request your report and receive a polling link in the response header. From there, you can poll the link provided until the report is available for you.
63
+
The following example requests are used by Microsoft customers to address common scenarios. The data returned by the request corresponds to the date when the cost got received by the billing system. It might include costs from multiple invoices. It's an asynchronous API. As such, you place an initial call to request your report and receive a polling link in the response header. From there, you can poll the link provided until the report is available for you.
64
64
65
-
Use the `retry-after` header in the API response to dictate when to poll the API next. The header provides an estimated minimum time that your report will take to generate.
65
+
Use the `retry-after` header in the API response to dictate when to poll the API next. The header provides an estimated minimum time that your report takes to generate.
66
66
67
67
To learn more about the API contract, see [Cost Details](/rest/api/cost-management/generate-cost-details-report) API.
68
68
@@ -72,7 +72,7 @@ To control whether you would like to see an actual cost or amortized cost report
72
72
73
73
Amortized cost breaks down your reservation purchases into daily chunks and spreads them over the duration of the reservation term. For example, instead of seeing a $365 purchase on January 1, you'll see a $1.00 purchase every day from January 1 to December 31. In addition to basic amortization, the costs are also reallocated and associated by using the specific resources that used the reservation. For example, if the $1.00 daily charge was split between two virtual machines, you'd see two $0.50 charges for the day. If part of the reservation isn't utilized for the day, you'd see one $0.50 charge associated with the applicable virtual machine and another $0.50 charge with a charge type of `UnusedReservation`. Unused reservation costs are seen only when viewing amortized cost.
74
74
75
-
Because of the change in how costs are represented, it's important to note that actual cost and amortized cost views will show different total numbers. In general, the total cost of months over time for a reservation purchase will decrease when viewing amortized costs. The months following a reservation purchase will increase. Amortization is available only for reservation purchases and doesn't currently apply to Azure Marketplace purchases.
75
+
Because of the change in how costs are represented, it's important to note that actual cost and amortized cost views show different total numbers. In general, the total cost of months over time for a reservation purchase will decrease when viewing amortized costs. The cost of months following a reservation purchase increase. Amortization is available only for reservation purchases and doesn't currently apply to Azure Marketplace purchases.
76
76
77
77
### Initial request to create report
78
78
@@ -82,7 +82,7 @@ POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/gen
82
82
83
83
**Request body:**
84
84
85
-
An example request for an ActualCost dataset for a specified date range is provided below.
85
+
Here's an example request for an ActualCost dataset for a specified date range.
86
86
87
87
```json
88
88
{
@@ -97,16 +97,16 @@ An example request for an ActualCost dataset for a specified date range is provi
97
97
98
98
Available *{scope}* options to build the proper URI are documented at [Identify the resource ID for a scope](../costs/understand-work-scopes.md#identify-the-resource-id-for-a-scope).
99
99
100
-
The available fields you can provide in the report request body are summarized below.
100
+
Here are the available fields you can provide in the report request body.
101
101
102
-
-**metric** - The type of report requested. It can be either ActualCost or AmortizedCost. Not required. If the field isn't specified, the API will default to an ActualCost report.
103
-
-**timePeriod** - The requested date range for your data. Not required. This parameter can't be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API will return the current month's cost.
104
-
-**invoiceId** - The requested invoice for your data. This parameter can only be used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing Profile or Customer scope. This parameter can't be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API will return the current month's cost.
105
-
-**billingPeriod** - The requested billing period for your data. This parameter can be used only by Enterprise Agreement customers. Use the YearMonth format. For example, 202008. This parameter can't be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API will return the current month's cost.
102
+
-**metric** - The type of report requested. It can be either ActualCost or AmortizedCost. Not required. If the field isn't specified, the API defaults to an ActualCost report.
103
+
-**timePeriod** - The requested date range for your data. Not required. This parameter can't be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API returns the current month's cost.
104
+
-**invoiceId** - The requested invoice for your data. This parameter is only used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing Profile or Customer scope. This parameter can't be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API returns the current month's cost.
105
+
-**billingPeriod** - The requested billing period for your data. This parameter is only used by Enterprise Agreement customers. Use the YearMonth format. For example, 202008. This parameter can't be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API returns the current month's cost.
106
106
107
107
**API response:**
108
108
109
-
`Response Status: 202 – Accepted` : Indicates that the request will be processed. Use the `Location` header to check the status.
109
+
`Response Status: 202 – Accepted` : Indicates that the request was accepted. Use the `Location` header to check the status.
110
110
111
111
Response headers:
112
112
@@ -117,15 +117,15 @@ Response headers:
117
117
118
118
### Report polling and download
119
119
120
-
Once you've requested to create a Cost Details report, poll for the report using the endpoint provided in the `location` header of the API response. An example polling request is below.
120
+
Poll for the report using the endpoint provided in the `location` header of the API response after you make a request to create a Cost Details report. Here's an example polling request.
121
121
122
122
Report polling request:
123
123
124
124
```http
125
125
GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/costDetailsOperationStatus/{operationId}?api-version=2022-05-01
126
126
```
127
127
128
-
`Response Status 200 – Succeeded`: Indicates that the request has succeeded.
128
+
`Response Status 200 – Succeeded`: Indicates that the request succeeded.
129
129
130
130
```JSON
131
131
{
@@ -159,18 +159,18 @@ GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/cost
159
159
}
160
160
```
161
161
162
-
A summary of the key fields in the API response is below:
162
+
Here's a summary of the key fields in the API response:
163
163
164
-
-**manifestVersion** - The version of the manifest contract that is used in the response. At this time, the manifest version will remain the same for a given API version.
164
+
-**manifestVersion** - The version of the manifest contract that is used in the response. At this time, the manifest version remains the same for a given API version.
165
165
-**dataFormat** - CSV is the only supported file format provided by the API at this time.
166
-
-**blobCount** - Represents the number of individual data blobs present in the report dataset. It's important to note that this API may provide a partitioned dataset of more than one file in the response. Design your data pipelines to be able to handle partitioned files accordingly. Partitioning will allow you to be able to ingest larger datasets more quickly moving forward.
166
+
-**blobCount** - Represents the number of individual data blobs present in the report dataset. It's important to note that this API might provide a partitioned dataset of more than one file in the response. Design your data pipelines to be able to handle partitioned files accordingly. Partitioning allows you to be able to ingest larger datasets more quickly moving forward.
167
167
-**byteCount** - The total byte count of the report dataset across all partitions.
168
168
-**compressData** - Compression is always set to false for the first release. The API will support compression in the future, however.
169
169
-**requestContext** - The initial configuration requested for the report.
170
170
-**blobs** - A list of n blob files that together comprise the full report.
171
171
-**blobLink** - The download URL of an individual blob partition.
172
172
-**byteCount** - The byte count of the individual blob partition.
173
-
-**validTill** - The date at which the report will no longer be accessible.
173
+
-**validTill** - The date when the report is no longer accessible.
0 commit comments