Generate Detailed Cost Report - Create Operation

Generates the detailed cost report for provided date range, billing period(only enterprise customers) or Invoice ID asynchronously at a certain scope. Call returns a 202 with header Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored.

POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport?api-version=2024-08-01

URI Parameters

Name In Required Type Description
scope
path True

string

The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Type Description
billingPeriod

string

Billing period in YearMonth(e.g. 202008) format. Only for legacy enterprise customers can use this. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided.

customerId

string

Customer ID for Microsoft Customer Agreement scopes (Invoice Id is also required for this).

invoiceId

string

Invoice ID for Pay-as-you-go and Microsoft Customer Agreement scopes. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided.

metric

GenerateDetailedCostReportMetricType

The type of the detailed report. By default ActualCost is provided

timePeriod

GenerateDetailedCostReportTimePeriod

Has time period for pulling data for the cost detailed report. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided.

Responses

Name Type Description
200 OK

GenerateDetailedCostReportOperationResult

Request processing completed.

202 Accepted

Accepted. Request will be processed. Use the Location header to check the status.

Headers

  • Location: string
  • Azure-Consumption-AsyncOperation: string
  • Azure-AsyncOperation: string
  • Retry-After: integer
Other Status Codes

GenerateDetailedCostReportErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod
GenerateDetailedCostReportByBillingProfileAndInvoiceId
GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId
GenerateDetailedCostReportByCustomerAndTimePeriod
GenerateDetailedCostReportBySubscriptionAndTimePeriod

GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod

Sample request

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/generateDetailedCostReport?api-version=2024-08-01

{
  "metric": "ActualCost",
  "billingPeriod": "202008"
}

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000",
  "name": "00000000-0000-0000-0000-000000000000",
  "type": "Microsoft.Consumption/operationResult",
  "properties": {
    "downloadUrl": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
    "validTill": "2020-12-08T05:55:59.4394737Z"
  }
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/operationResults/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Azure-Consumption-AsyncOperation: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/operationStatus/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Retry-After: 60

GenerateDetailedCostReportByBillingProfileAndInvoiceId

Sample request

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/generateDetailedCostReport?api-version=2024-08-01

{
  "metric": "ActualCost",
  "invoiceId": "M1234567"
}

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000",
  "name": "00000000-0000-0000-0000-000000000000",
  "type": "Microsoft.Consumption/operationResult",
  "properties": {
    "downloadUrl": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
    "validTill": "2020-12-08T05:55:59.4394737Z"
  }
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/operationResults/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Azure-Consumption-AsyncOperation: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/operationStatus/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Retry-After: 60

GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId

Sample request

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/generateDetailedCostReport?api-version=2024-08-01

{
  "metric": "ActualCost",
  "invoiceId": "M1234567",
  "customerId": "456789"
}

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000",
  "name": "00000000-0000-0000-0000-000000000000",
  "type": "Microsoft.Consumption/operationResult",
  "properties": {
    "downloadUrl": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
    "validTill": "2020-12-08T05:55:59.4394737Z"
  }
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/operationResults/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Azure-Consumption-AsyncOperation: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/operationStatus/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Retry-After: 60

GenerateDetailedCostReportByCustomerAndTimePeriod

Sample request

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/generateDetailedCostReport?api-version=2024-08-01

{
  "metric": "ActualCost",
  "timePeriod": {
    "start": "2020-03-01",
    "end": "2020-03-15"
  }
}

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000",
  "name": "00000000-0000-0000-0000-000000000000",
  "type": "Microsoft.Consumption/operationResult",
  "properties": {
    "downloadUrl": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
    "validTill": "2020-12-08T05:55:59.4394737Z"
  }
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/operationResults/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Azure-Consumption-AsyncOperation: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/operationStatus/ad0d632f-1186-41fe-89f9-ae29e198d223?api-version=2021-10-01
Retry-After: 60

GenerateDetailedCostReportBySubscriptionAndTimePeriod

Sample request

POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/generateDetailedCostReport?api-version=2024-08-01

{
  "metric": "ActualCost",
  "timePeriod": {
    "start": "2020-03-01",
    "end": "2020-03-15"
  }
}

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000",
  "name": "00000000-0000-0000-0000-000000000000",
  "type": "Microsoft.Consumption/operationResult",
  "properties": {
    "downloadUrl": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
    "validTill": "2020-12-08T05:55:59.4394737Z"
  }
}
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000?api-version=2021-10-01
Azure-Consumption-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2021-10-01
Retry-After: 60

Definitions

Name Description
ErrorDetails

The details of the error.

GenerateDetailedCostReportDefinition

The definition of a cost detailed report.

GenerateDetailedCostReportErrorResponse

Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.

Some Error responses:

  • 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead.

  • 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.

  • 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.

GenerateDetailedCostReportMetricType

The type of the detailed report. By default ActualCost is provided

GenerateDetailedCostReportOperationResult

The result of the long running operation for cost detailed report.

GenerateDetailedCostReportTimePeriod

The start and end date for pulling data for the cost detailed report.

ErrorDetails

The details of the error.

Name Type Description
code

string

Error code.

message

string

Error message indicating why the operation failed.

GenerateDetailedCostReportDefinition

The definition of a cost detailed report.

Name Type Description
billingPeriod

string

Billing period in YearMonth(e.g. 202008) format. Only for legacy enterprise customers can use this. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided.

customerId

string

Customer ID for Microsoft Customer Agreement scopes (Invoice Id is also required for this).

invoiceId

string

Invoice ID for Pay-as-you-go and Microsoft Customer Agreement scopes. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided.

metric

GenerateDetailedCostReportMetricType

The type of the detailed report. By default ActualCost is provided

timePeriod

GenerateDetailedCostReportTimePeriod

Has time period for pulling data for the cost detailed report. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided.

GenerateDetailedCostReportErrorResponse

Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.

Some Error responses:

  • 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead.

  • 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.

  • 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.

Name Type Description
error

ErrorDetails

The details of the error.

GenerateDetailedCostReportMetricType

The type of the detailed report. By default ActualCost is provided

Name Type Description
ActualCost

string

AmortizedCost

string

GenerateDetailedCostReportOperationResult

The result of the long running operation for cost detailed report.

Name Type Description
id

string

The ARM resource id of the long running operation.

name

string

The name of the long running operation.

properties.downloadUrl

string

The URL to download the generated report.

properties.expiryTime

string

The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.

properties.validTill

string

The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.

type

string

The type of the long running operation.

GenerateDetailedCostReportTimePeriod

The start and end date for pulling data for the cost detailed report.

Name Type Description
end

string

The end date to pull data to. example format 2020-03-15

start

string

The start date to pull data from. example format 2020-03-15