question

ScottM-7356 avatar image
0 Votes"
ScottM-7356 asked azure-cxp-api edited

Get-AzConsumptionUsageDetail - How to sum all PretaxCost rows returned and save to an excel or csv file?

Is there an example for how to sum the PretaxCost property for all objects returned by Get-AzConsumptionUsageDetail?

windows-server-powershellazure-cost-managementazure-automation
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichMatheisen-8856 avatar image
1 Vote"
RichMatheisen-8856 answered

The cmdlet returns a PSUsageObject, so this might be what you need:

 Get-AzConsumptionUsageDetail |
     Measure-Object -Sum -Property PretaxCost
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.