Reputation: 176
I am following this link to get my usage details for azure account. As per the official documentation, by using $expand=properties/additional properties should return additional properties (such as consumed service, cost center etc) in result set. However I am getting the same output irrespective of using expand in url.
URLs used are as below
Without expand : https://management.azure.com/subscriptions/{subscriptionid}/providers/Microsoft.Consumption/usageDetails?api-version=2018-06-30&
With expand : https://management.azure.com/subscriptions/{subscriptionid}/providers/Microsoft.Consumption/usageDetails?api-version=2018-06-30&$expand=properties/additionalProperties
Both the requests are returning same result set. Am I missing something here?
Upvotes: 0
Views: 594
Reputation: 191
Try using this API this works for me:
https://management.azure.com/subscriptions/{Subsid}/providers/Microsoft.Billing/billingPeriods/202204/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails,additionalProperties&metric=AmortizedCost&api-version=2019-05-01
Upvotes: 0
Reputation: 12768
By default, the API only returns summarized usage information with a meter ID. If you want additional information on the meter, or additional information about the resource, you will need to add the expand parameter with the appropriate value:
You may try Sample Call for Additional Details:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/usageDetails?api-version=2018-03-31&$expand=properties/additionalProperties
Please note that additionalProperties field will show up only when some additional data is available. For most cases, in general, there is no additional data. If some information is always expected to be available in additionalProperties, then it should be part of properties field in response and not the additionalProperties. additionalProperties is only for displaying some special/edge case information, which is not a candidate for a the main properties field.
The additionalProperties field will be present in response, if there are some additional info available to show, else it will be omitted to optimize the response payload size.
Upvotes: 0