Query consumption data for an Azure subscription.
Table Specific Information
There are 2 different time concepts involved in understanding consumption data:
- Reported DateTime: This is the timestamp at which the Azure usage event was recorded in the billing system. This is the timestamp that is used to determine whether a particular usage event made it into a billing cycle, or whether it was dropped due to lateness.
- Usage DateTime: This is the timestamp of the actual consumption of the Azure resource.
If you do not specify ReportStartTime and ReportEndTime, they will have these default values:
- ReportStartTime= 30 days before the DateTime of query execution.
- ReportEndTime= 1 day before the DateTime of query execution.
Currently, you must use ReportStartTime and ReportEndTime for server-side filtering. Only filters with ReportStartTime, ReportEndTime, AggregationGranularity, and ShowDetails are processed server side; the component will execute other filters client-side within itself. For example, the following queries are processed server side:
SELECT * FROM ConsumptionData SELECT * FROM ConsumptionData WHERE ReportStartTime='2014-05-15' AND ReportEndTime='2018-02-15'
In addition, you can specify AggregationGranularity, which offers daily or hourly resolution, and ShowDetails for more or less information with the usage data.
SELECT * FROM ConsumptionData WHERE ReportStartTime='08/29/2017 08:00:12' AND ReportEndTime='08/29/2017 23:00:12' AND AggregationGranularity='Hourly' AND ShowDetails=FalseYou can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will cause an error.
|ReportStartTime||Datetime||This dateTimeOffset value represents the timestamp at which the resource usage was recorded within the Azure billing system.|
|ReportEndTime||Datetime||This dateTimeOffset value represents the timestamp at which the resource usage was recorded within the Azure billing system.|
|ShowDetails||Boolean||Specify whether the caller wants instance-level details with the usage data. By default, this is set to true. By setting this input to false, there will be fewer aggregates returned by the API, as the service will do server-side aggregation.|
|AggregationGranularity||String||This input has two discrete potential values: Daily and Hourly. As the values suggest, the former one returns the data in daily granularity whereas the latter one is hourly resolution. Daily is the default.|
|SubscriptionId||String||The subscription ID.|
|Id||String||Unique Id for the usage aggregate.|
|Name||String||Name of the usage aggregate.|
|MeterId||String||Unique ID for the resource that was consumed (aka ResourceID).|
|UsageStartTime||Datetime||UTC start time for the usage bucket to which this usage aggregate belongs.|
|UsageEndTime||Datetime||UTC end time for the usage bucket to which this usage aggregate belongs.|
|Quantity||Double||The amount of the resource consumption that occurred in this time frame.|
|Unit||String||The unit in which the usage for this resource is being counted, e.g. 'Hours', 'GB'.|
|MeterName||String||Friendly name of the resource being consumed.|
|MeterCategory||String||Category of the consumed resource.|
|MeterSubCategory||String||Sub-category of the consumed resource.|
|MeterRegion||String||Region of the meterId used for billing purposes.|
|InstanceData||String||This column represents the instance level details in the new format.|
|InfoFields||String||This column represents the instance level details in the legacy format. The most important item here is 'Project' because this carries the name of the instance provisioned by the user. If we spun up a website and called it 'azuretestvm1', the string 'azuretestvm1' would show up as a value for Project for the website events for this website.|