How long a virtual machine running under the subscripion

Copper Contributor

Hi there, I would like to find out how long (how many years/Month/days) certain virtual machines running on Azure. How can fetch these details?

 

Cheers

Salai

2 Replies

@SalaiJ 

 

depending on your expectations, it may or not be possible to get the information you want.

 

1. The VM's operating system can tell you the uptime, but this is mostly inaccurate, as the VM may have rebooted many times since its creation.

2. Azure Activity Log provides you with an history of operations made on your Azure resources (creation, update, delete), but it is queryable only for the past 90 days. Again, a solution that falls short, unless you were exporting Activity Logs to a Storage Account or Log Analytics workspace with a longer retention.

3. If you look at the VM's OS managed disk properties, you can see when the disk was created (see capture below). This solution would work for all your VMs that run on managed disks, provided the OS disk was never swapped.

 

Out of the box, there is not a 100% accurate answer, but I hope these hints help you somehow.

 

hspinto_1-1609776576908.png

 

 

Thanks for your response.