I wanted to get the cost of a VM each day. I came up with the following code. Just the VM cost, not the ingress (DataTrIn) or egress (DataTrOut). I hope it helps someone!
$results=Get-AzConsumptionUsageDetail -StartDate 2019-12-01 -EndDate 2019-12-10 -IncludeAdditionalProperties $subscriptions="YourSubName" foreach ($sub in $subscriptions){ $results | ` where {$_.ConsumedService -eq 'Microsoft.Compute'} | ` where {$_.SubscriptionName -eq $sub}| ` Select UsageStart, InstanceName, UsageQuantity,PreTaxCost,@{N="UsageType";E={(ConvertFrom-Json $($_.AdditionalInfo)).UsageType}} | ` where {$_.UsageType -eq 'ComputeHR'} | ` Sort-Object InstanceName,UsageStart | ft }
Thanks for the Script