How to know when my VM started before 90 days ?

RCB 101 Reputation points
2022-12-12T20:03:46.46+00:00

Hello,

i would like to know when my VM has been started for the last time (and by who if possible), but this date is more than 90 days ago, so i cannot retrieve it from Event logs.
Is there another way to have this information ?

thanks.

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

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 26,811 Reputation points Microsoft Employee Moderator
    2022-12-13T01:35:56.027+00:00

    Hello, @RCB !

    If you backup your logs either by downloading them or by sending them to a Log Analytics workspace, you can still search through the log activity but by default, Azure logs are deleted after 90 days which would limit your options to what you can run on your VM at the OS level (which may include Get-CimInstance with LastBootUpTime).

    How do I check the last boot time of my VM more than 90 days ago?
    Activity log events are kept by Azure for 90 days and then they are deleted. You can extend this period by downloading the activity log, sending the log to a Log Analytics workspace, sending the log to Azure Storage, or by using another collection method.

    If you did not make a copy of the logs or otherwise back them up and 90 days has passed, then you can still access the OS disk of the VM (which is persistent). Options at this point may be limited but you can try using an OS level command like Get-CimInstance with LastBootUpTime:

    Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime  
    

    269822-image.png

    Additional Reading:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.