Skip to main content

generate_cost_details_report

Creates, updates, deletes, gets or lists a generate_cost_details_report resource.

Overview

Namegenerate_cost_details_report
TypeResource
Idazure.cost_management.generate_cost_details_report

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe id of the long running operation.
namestringThe name of the long running operation.
errorobjectThe details of the error.
manifestobjectThe manifest of the report generated by the operation.
statusstringThe status of the cost details operation. Known values are: "Completed", "NoDataFound", and "Failed". (Completed, NoDataFound, Failed)
typestringThe type of the long running operation.
validTillstring (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:

NameAccessible byRequired ParamsOptional ParamsDescription
get_operation_resultsselectscope, operation_idGet the result of the specified operation. This link is provided in the CostDetails creation request response Location header.
create_operationexecscopeThis 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.

NameDatatypeDescription
operation_idstringThe target operation Id. Required.
scopestringThe 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 _. Required.

SELECT examples

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.generate_cost_details_report
WHERE scope = '{{ scope }}' -- required
AND operation_id = '{{ operation_id }}' -- required
;

Lifecycle Methods

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 _.

EXEC azure.cost_management.generate_cost_details_report.create_operation 
@scope='{{ scope }}' --required
@@json=
'{
"metric": "{{ metric }}",
"timePeriod": "{{ timePeriod }}",
"billingPeriod": "{{ billingPeriod }}",
"invoiceId": "{{ invoiceId }}"
}'
;