Query to list the virtual machines for which perodic assement is not enabled

Varma 1,250 Reputation points

Is there any query to list of virtual machines for which periodic assessment not enabled?

I am looking for only for one subscription.

Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
264 questions
0 comments No comments
{count} votes

Accepted answer
  1. Deepanshu katara 6,395 Reputation points

    Hi Varma

    I would suggest to use Azure Resource Graph for that. It will be faster and easier. Example query to use is

    | where type =~ "microsoft.compute/virtualmachines" 
    |  where properties.storageProfile.osDisk.osType in~ ('Linux','Windows')
    | extend patchSettingsObject = iff(properties.storageProfile.osDisk.osType =~ "windows", properties.osProfile.windowsConfiguration.patchSettings, properties.osProfile.linuxConfiguration.patchSettings)
    | extend assessMode = tostring(patchSettingsObject.assessmentMode)
    | extend periodicAssessment = iff(isnotnull(assessMode) and assessMode =~ "AutomaticByPlatform", "Yes", "No")

    Remember that machine needs to be running otherwise it will give No on periodicAssessment result.

    User's image

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

0 additional answers

Sort by: Most helpful