- 27 Oct 2024
- 4 Minutes to read
- Print
- DarkLight
- PDF
Get Azure Consumption Report
- Updated on 27 Oct 2024
- 4 Minutes to read
- Print
- DarkLight
- PDF
URL
{{customerId}} – This is a mandatory parameter. Pass the Microsoft customer Id to this parameter to get the details of a particular customer.
{{subscriptionId}} – This is an optional parameter. Pass the subscription Id to this parameter to get the details of a particular subscription.
{{page}} – This is a mandatory parameter. Pass a value to this parameter to get desired number of records in the consumption report
{{startIndex}} – This is a mandatory parameter. Pass a value to this parameter to assign a start index. This is analogous to the page index and the results are treated page-wise with the number of records per page controlled by the pageSize value.
{{month}} – This is a mandatory parameter. Pass the calendar month number to this parameter to get the details of a month.1 – January, 2 – February, etc. The month corresponds to the month when the bill was generated from Microsoft. It translates to the consumption from the previous month.
Eg: Passing June, 2020 would get the consumption for the month of May as we are adding the date when the bill is generated in June, 2020 and this actually corresponds to the consumption reported in May.
{{year}} – This is a mandatory parameter. Pass the year to this parameter to get the details of a particular year. Only current year and the previous year are supported.
{{date}} – This is an optional parameter. Pass the date to this parameter to get the report for a particular day in the month and year.
{{entitlementId}} – This is an optional parameter. Pass the entitlementId to this parameter to get the details of an entitlement. Entitlement is relevant if the subscription is an Azure Plan subscription.
{{resourceGroup}} – This is an optional parameter. Pass the resource group name to this parameter to get the aggregates by resource group.
{{resourceName}} – This is an optional parameter. Pass the resource name to this parameter to get the details for a resource.
Request headers
Key | Value |
Authorization | Bearer <access_token> |
Content-Type | Application/json |
Request body
The request requires parameters if only you want to apply filters by one of the optional parameters.
Response body
An example response for the request to get consumption report is as follows:
{
"OperationType": null,
"Status": "Success",
"RequestCorrelationID": "f2cdf3b3-7043-463a-be65-ee6470ee11ac",
"ErrorMessage": null,
"ErrorDetail": null,
"Data": [
{
"SubscriptionName": "Azure plan",
"EntitlementName": "Azure subscription 1",
"EntitlementId": "85BF4F5E-789B-4578-8928-7FB014373442",
"AdditionalInfo": "",
"ReservationId": null,
"MeterId": "12df5678-0fa0-47c0-accd-96b7aee6361f",
"ProductId": "DZH318Z0BP88",
"SkuId": "00F3",
"ConsumedService": "Microsoft.Compute",
"ResourceURI": "/subscriptions/85BF4F5E-789B-4578-8928-7FB014373442/resourceGroups/RG-ABC-HG-CENTRALUS-01/providers/Microsoft.Sql/servers/sql-duxhg-01/elasticPools/sqlep-duxhg-01",
"BenefitOrderId": "ed56cbi7-3e5c-1683-8da0-82b45f9b034e",
"BenefitId": "4fg7c302-f836-4298-121d-fd9bba38fd9f",
"BenefitType": "SavingsPlan",
"ID": 1,
"TenantId": "1267hj090-afcf-fch9-a93e-cf4bfb679a7e",
"SubscriptionId": "bb2edc1a-91f0-03ae-8b9e-96543e42df34",
"AzureResourceGroupName": "RG-ABC-HG-CENTRALUS-01",
"AzureResourceCategory": "SQL Database",
"AzureResourceSubCategory": "SQL Database Single/Elastic Pool General Purpose - SQL License",
"AzureResourceType": "1 vCore Hour",
"AzureResourceName": "sqlep-duxhg-01",
"ChargeDate": "2024-09-01T00:00:00",
"Quantity": 96.00000000,
"Unit": "1 Hour",
"ChargeForCustomer": 9.59673600,
"ChargedByMS": 8.15709677,
"ChargeForReseller": 8.15709677,
"Location": "CENTRALUS",
"Tags": "{\"SQLserverUS\":\"//subscriptions/85BF4F5E-789B-4578-8928-7FB014373442/resourceGroups/RG-ABC-HG-CENTRALUS-01/Microsoft.DesktopVirtualization/SQLServer/RG-ABC-HG-CENTRALUS-01\"}"
},
Here is the explanation for the properties in the response (JSON)
Property | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OperationType | Can be ignored | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Status | Indicates the status of the request. Possible values – Success / Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RequestCorrelationID | Internal ID generated by C3 for correspondence for troubleshooting issues, if any. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorMessage | Message in case the request runs into an error during processing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorDetail | Additional detail related to the error in case there is an error while processing the request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Data | Contains a list of consumption report objects represented by the following attributes:
|
Error response
The API validates the input parameters – Returns 400 – Bad request error in case the input is found to be invalid.
A sample bad request error covering both the attributes is as follows:
{
"OperationType": null,
"Status": "Error",
"RequestCorrelationID": "fe8ff19e-b9eb-4a43-af0f-418e86b9b200",
"ErrorMessage": "ERROR_DESC_BAD_INPUT",
"ErrorDetail": "ERROR_DESC_BAD_INPUT",
"Data": [
{
"Atribute": "TenantId",
"AtributeKey": "TENANT_ID",
"Message": "INVALID_CUSTOMER_ID",
"DefaultMessage": "Invalid Customer ID",
"Value": "b8177a6b-868a-44e4-9bf7-b13dd5a13d01"
}
The following table explains the constituents of the response in detail:
Property | Description |
OperationType | Can be ignored |
Status | Indicates the status of the request. Possible values – Success / Error |
RequestCorrelationID | Internal ID generated by C3 for correspondence for troubleshooting issues, if any. |
ErrorMessage | Message in case the request runs into an error during processing |
ErrorDetail | Additional detail related to the error in case there is an error while processing the request |
Data | Contains a list of validation errors represented by the following attributes:
|