Azure unused resources which are older than 30 days

Gayathri Ravichandran 21 Reputation points
2023-04-06T07:16:55.5733333+00:00

I have the following KQL to find unused disks resources | where type has "microsoft.compute/disks" | extend diskState = tostring(properties.diskState) | where managedBy == "" | where not(name endswith "-ASRReplica" or name startswith "ms-asr-") Is there a way to modify the query and show unused disks which was created atleast 30 days before?

Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
583 questions
{count} votes

Accepted answer
  1. David Pazdera 316 Reputation points
    2023-04-06T11:58:38.37+00:00

    Hi Gayathri, Would this query work for you?

    
    resources 
    | where type has "microsoft.compute/disks" 
    | extend diskState = tostring(properties.diskState)
    | extend createdTimeStamp = properties.timeCreated
    | where managedBy == "" 
    | where not(name endswith "-ASRReplica" or name startswith "ms-asr-")
    | where createdTimeStamp < now()-timespan(30d)
    

0 additional answers

Sort by: Most helpful