Get cost details for a pay-as-you-go subscription
If you have an MSDN, Microsoft Online Service Program (MOSP) pay-as-you-go, or Visual Studio Azure subscription, we recommend that you use Exports or the Exports API to get cost details data (formerly known as usage details). The Cost Details API report isn't supported for your subscription type yet.
If you need to download small datasets and you don't want to use Azure Storage, you can also use the Consumption Usage Details API. Instructions about how to use the API are below.
Note
The API is deprecated for all customers except those with MSDN, pay-as-you-go and Visual Studio subscriptions. If you're an EA or MCA customer don't use this API.
The date that the API will be turned off is still being determined. The Cost Details API will be updated to support MSDN, pay-as-you-go and Visual studio subscriptions prior to the deprecation of the Consumption Usage Details API.
Example Consumption Usage Details API requests
The following example requests are used by Microsoft customers to address common scenarios.
Get usage details for a scope during a specific date range
The data that's returned by the request corresponds to the date when the data was received by the billing system. It might include costs from multiple invoices. The call to use varies by your subscription type.
For pay-as-you-go subscriptions, use the following call.
GET https://management.azure.com/{scope}/providers/Microsoft.Consumption/usageDetails?$filter=properties%2FusageStart%20ge%20'2020-02-01'%20and%20properties%2FusageEnd%20le%20'2020-02-29'&$top=1000&api-version=2019-10-01
Get amortized cost details
If you need actual costs to show purchases as they're accrued, change the metric
to ActualCost
in the following request. To use amortized and actual costs, you must use version 2019-04-01-preview
or later.
GET https://management.azure.com/{scope}/providers/Microsoft.Consumption/usageDetails?metric=AmortizedCost&$filter=properties/usageStart+ge+'2019-04-01'+AND+properties/usageEnd+le+'2019-04-30'&api-version=2019-04-01-preview
Next steps
- Read the Ingest cost details data article.
- Learn how to Get small cost datasets on demand.
- Understand cost details fields.
- Create and manage exported data in the Azure portal with exports.
- Automate Export creation and ingestion at scale using the API.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for