Skip to main content

cost_details_reports

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

Overview

Namecost_details_reports
TypeResource
Idazure.cost_management.cost_details_reports

Fields

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
typestringThe type of the long running operation.
validTillstringThe time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.

Methods

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

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.cost_details_reports
WHERE operationId = '{{ operationId }}'
AND scope = '{{ scope }}';

INSERT example

Use the following StackQL query and manifest file to create a new cost_details_reports resource.

/*+ create */
INSERT INTO azure.cost_management.cost_details_reports (
scope,
metric,
timePeriod,
billingPeriod,
invoiceId
)
SELECT
'{{ scope }}',
'{{ metric }}',
'{{ timePeriod }}',
'{{ billingPeriod }}',
'{{ invoiceId }}'
;