Hi Varma
I would suggest to use Azure Resource Graph for that. It will be faster and easier. Example query to use is
resources
| 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.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.