Hi @zonx93 ,
Vous trouverez ci-dessous la requête Azure Resource Graph qui récupère l’état de mise à jour de chaque machine virtuelle, ainsi qu’une liste détaillée des champs pris en charge. Faites-nous savoir si vous avez besoin d’informations supplémentaires ou d’une assistance supplémentaire.
resources
| extend joinId = tolower(id)
| extend vmName = name
| extend azureOs = tostring(properties.storageProfile.osDisk.osType)
| extend arcOs = coalesce(tostring(properties.osName), tostring(properties.osType))
| extend os = coalesce(azureOs, arcOs)
| extend osType = iff(os =~ "Windows", "Windows", "Linux")
| join kind=leftouter (
resources
| where type in~ ("Microsoft.SqlVirtualMachine/sqlVirtualMachines", "microsoft.azurearcdata/sqlserverinstances")
| project resourceId = iff(type =~ "Microsoft.SqlVirtualMachine/sqlVirtualMachines", tolower(properties.virtualMachineResourceId), tolower(properties.containerResourceId)), sqlType = type
| summarize by resourceId, sqlType
) on $left.joinId == $right.resourceId
| extend type = iff(isnotempty(sqlType), sqlType, type)
| project-away sqlType, resourceId
| join kind = leftouter (
patchassessmentresources
| where type in~ ("microsoft.compute/virtualmachines/patchassessmentresults/softwarePatches", "microsoft.hybridcompute/machines/patchassessmentresults/softwarePatches")
| parse id with resourceId "/patchAssessmentResults" *
| extend joinId = tolower(resourceId)
| extend uniquePatchNameWithVersion = iff(isnull(properties.kbId), strcat(tostring(properties.patchName), '_', tostring(properties.version)), properties.patchName)
| extend publishedDateTime = iff(isnotnull(properties.publishedDateTime), properties.publishedDateTime, "N/A")
| extend rebootRequired = iff(isnotnull(properties.rebootBehavior), properties.rebootBehavior, "N/A")
| extend classification = iff(properties.classifications[0] =~ "UpdateRollUp", "UpdateRollup", iff(isempty(properties.classifications[0]), "Unsupported", properties.classifications[0]))
| extend msrcSeverity = iff(isnotnull(properties.msrcSeverity), properties.msrcSeverity, "NotAvailable")
| extend classificationPriority = iff(classification contains "Security", 0, (iff(classification == "Critical" , 1, 2)))
| project joinId, assessProperties = properties, publishedDateTime, rebootRequired, classification, msrcSeverity, classificationPriority
) on $left.joinId == $right.joinId
| where isnotnull(assessProperties)
| extend osUpdateClassification = iff(osType =~ "Linux", strcat("linux", tolower(classification)), tolower(classification))
// Count will indicate the number of machines with said update pending across selected subscription(s)
| summarize count() by vmName, publishedDateTime, tostring(assessProperties.patchId), tostring(assessProperties.patchName), tostring(assessProperties.version), tostring(assessProperties.kbId), rebootRequired, osType, tostring(classification), msrcSeverity, classificationPriority
Veuillez trouver la capture d’écran de sortie ci-dessous
Je vous remercie
Please let me know if you face any challenge here, I can help you to resolve this issue further
Please provide your valuable comments
Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.