azure virtual machine questions

Fredrik Johansson 21 Reputation points
  1. Where on the Azure portals do you see a summary per Virtual Machine about the total time the machine has been up per month? Not Usage but the number of hours the machine spun
  2. Is there any PowerShell script from MS to get out the number of hours per virtual machine
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,386 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 100.1K Reputation points MVP

    Hi @Fredrik Johansson ,

    if the VMs are connected with a Log Analytics Workspace you can try this Kusto query to get the uptime in hours:

    | where TimeGenerated > ago(7d)  
    | summarize heartbeats_per_hour=count() by bin(TimeGenerated, 1h), Computer  
    | extend state_per_hour=iff(heartbeats_per_hour>0, true, false)  
    | summarize total_running_hours=countif(state_per_hour==true) by Computer  

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Andreas Baumgarten

0 additional answers

Sort by: Most helpful