Forum Discussion
SalaiJ
Jan 03, 2021Copper Contributor
How long a virtual machine running under the subscripion
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
hspinto
Microsoft
Jan 04, 2021
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.
SalaiJ
Jan 10, 2021Copper Contributor
Thanks for your response.