Virtual Machines Running Time

Padathuvali Joseph 1 Reputation point

How to get VM Running time(hours) per day over a period of last 30ddays on daily intervals?
Is there any API related to get?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,381 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. srbhatta-MSFT 8,546 Reputation points Microsoft Employee

    Hi @Padathuvali Joseph ,
    We get this query quite a lot here on community.
    There is no API to get the VM uptime/running hours directly. However, you can formulate your own Log Analytics Query to query the heartbeat of the VM through Azure Log Analytics Workspace using Azure Monitor, but it might not always be accurate because if in any case the VM agent goes down, then the heartbeat of the VM will not be reported back to the Azure Platform.

    There is an already thread existing on community. You can refer to that below.

    Do let me know if this helps. If it doesn't help, please reach back so that I can look into this further :)


    0 comments No comments