Edit

Share via


Queries for the DevCenterBillingEventLogs table

For information on using these queries in the Azure portal, see Log Analytics tutorial. For the REST API, see Query.

DevCenter - DevBox storage and compute usage breakdown by dev box

Get the total storage and compute units for a given month.

let startSearchTime = startofmonth(now());
let endSearchTime = startofmonth(now(), 1); // The second parameter represents the number of months to offset from the input date.
DevCenterBillingEventLogs 
| where OperationName == "DevBoxUsage"
    and StartTime >= startSearchTime 
    and StartTime < endSearchTime
| extend DevBoxName = UsageResourceName
| extend DevBoxId = UsageResourceUniqueId
| summarize StorageHours = countif(UsageType == "Storage"),
    StorageMeterQuantity = round(sum(iff(UsageType == "Storage", Quantity, 0.0)), 6),
    TotalRunningHours = round(sum(iff(UsageType == "Compute", Quantity, 0.0)), 6),
    NormalRateComputeHours = round(sum(iff(UsageType == "Compute" and IsOverMonthlyBillingCap == false, Quantity, 0.0)), 6),
    DiscountRateComputeHours = round(sum(iff(UsageType == "Compute" and IsOverMonthlyBillingCap == true, Quantity, 0.0)), 6) 
    by DevBoxName, DevBoxId
| project-reorder DevBoxName, DevBoxId, StorageHours, StorageMeterQuantity, TotalRunningHours, NormalRateComputeHours, DiscountRateComputeHours

DevCenter - DevBox billing meter breakdown by Pool

Get the total meter units by Pool for a given month.

let startSearchTime = startofmonth(now());
let endSearchTime = startofmonth(now(), 1); // The second parameter represents the number of months to offset from the input date.
DevCenterBillingEventLogs 
| where OperationName == "DevBoxUsage"
    and StartTime >= startSearchTime 
    and StartTime < endSearchTime
| extend Pool = tolower(BilledResourceId)
| summarize MeterUsage = round(sum(Quantity), 6)
    by Pool, MeterId, UsageType