cost_details_reports
Creates, updates, deletes, gets or lists a cost_details_reports
resource.
Overview
Name | cost_details_reports |
Type | Resource |
Id | azure.cost_management.cost_details_reports |
Fields
The following fields are returned by SELECT
queries:
- get_operation_results
OK. The request has succeeded.
Name | Datatype | Description |
---|---|---|
id | string | The id of the long running operation. |
name | string | The name of the long running operation. |
error | object | The details of the error. |
manifest | object | The manifest of the report generated by the operation. |
status | string | The status of the cost details operation |
type | string | The type of the long running operation. |
validTill | string (date-time) | The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_operation_results | select | scope , operationId | Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. | |
create_operation | insert | scope | This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields |
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 |
---|---|---|
operationId | string | The target operation Id. |
scope | string | The ARM Resource ID for subscription, billing account, or other billing scopes.Currently Resource Group and Management Group are not supported. For details, see https://aka.ms/costmgmt/scopes. |
SELECT
examples
- get_operation_results
Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header.
SELECT
id,
name,
error,
manifest,
status,
type,
validTill
FROM azure.cost_management.cost_details_reports
WHERE scope = '{{ scope }}' -- required
AND operationId = '{{ operationId }}' -- required
;
INSERT
examples
- create_operation
- Manifest
This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields
INSERT INTO azure.cost_management.cost_details_reports (
data__metric,
data__timePeriod,
data__billingPeriod,
data__invoiceId,
scope
)
SELECT
'{{ metric }}',
'{{ timePeriod }}',
'{{ billingPeriod }}',
'{{ invoiceId }}',
'{{ scope }}'
RETURNING
id,
name,
error,
manifest,
status,
type,
validTill
;
# Description fields are for documentation purposes
- name: cost_details_reports
props:
- name: scope
value: string
description: Required parameter for the cost_details_reports resource.
- name: metric
value: string
description: |
The type of the detailed report. By default ActualCost is provided
valid_values: ['ActualCost', 'AmortizedCost']
- name: timePeriod
value: object
description: |
The specific date range of cost details requested for the report. This parameter cannot be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. API only allows data to be pulled for 1 month or less and no older than 13 months. If no timePeriod or billingPeriod or invoiceId is provided the API defaults to the open month time period
- name: billingPeriod
value: string
description: |
This parameter can be used only by Enterprise Agreement customers. Use the YearMonth(e.g. 202008) format. This parameter cannot be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost.
- name: invoiceId
value: string
description: |
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 cannot be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost.