I have been trying to get the last active time of a disk/VM using Kusto Query Language on Azure portal. Is it possible to track it? I want this information to alert the user if that resource is not used for more than 14 days.
Also, could anyone help me finding out if there is any other way to query the list of unused resources (say for N days) within a subscription?
Thanks!
As far as I know, you need to find the max
authenticationStepDateTimeto be more than 14 days ago.To get the list of unused resources (say for N=15 days) within a subscription using Kusto Query Language on Azure portal, try using the sample query like below:
whereclause and pipe (|) delimiter are key to writing KQL queries.extendto provide an alias for timestamps that compute the session duration based on queried date and time.For your reference, please find these links:Ref1, Ref2