Query's uitvoeren op Updatebeheer-logboeken

Naast de details die tijdens de implementatie van Updatebeheer worden gegeven, kunt u zoeken in de logboeken die zijn opgeslagen in uw Log Analytics-werkruimte. Als u in de logboeken van uw Automation-account wilt zoeken, selecteert u Updatebeheer en opent u de Log Analytics-werkruimte die is gekoppeld aan uw implementatie.

U kunt ook de logboekquery's aanpassen of ze van verschillende clients gebruiken. Raadpleeg de documentatie voor de Zoek-API voor Log Analytics.

Query-updaterecords

Updatebeheer verzamelt records voor Virtuele Windows- en Linux-machines en de gegevenstypen die worden weergegeven in de zoekresultaten van logboeken. In de volgende secties worden deze records beschreven.

Record bijwerken van query's

Er wordt een record met een type Update gemaakt dat de beschikbare updates en de installatiestatus voor een computer vertegenwoordigt. Deze records hebben de eigenschappen in de volgende tabel:

Eigenschappen Beschrijving
Tenant-ID Unieke id die het exemplaar van Microsoft Entra-id van uw organisatie vertegenwoordigt.
SourceSystem Het bronsysteem voor de record. De waarde is OperationsManager.
TimeGenerated De datum en tijd waarop de record is gemaakt.
SourceComputerId Unieke id die de broncomputer vertegenwoordigt.
Title De titel van de update.
Classificatie Goedkeuringsclassificatie. De waarde is Updates.
PublishedDate (UTC) De datum waarop de update gereed is om te worden gedownload en geïnstalleerd vanuit Windows Update.
Computer Volledig gekwalificeerde domeinnaam van rapportagecomputer.
UpdateState De huidige status van de update.
Product De producten waarvoor de update van toepassing is.
OSType Type besturingssysteem. Waarden zijn Windows of Linux.
ProductVersion Versie van de update.
Product Arch Toepasselijke machinearchitectuur
CVENumbers Veelvoorkomende beveiligingsproblemen en blootstellingsnummers
BulletinUrl URL van het bulletin
BulletinID Nummer van bulletin-id.
PackageRepository Opslagplaatsgegevens van het pakket.
PackageSeverity Ernst van de update.
OSName Type besturingssysteem. Waarden zijn Windows of Linux.
OSVersion De versie van het besturingssysteem.
OSFullName Naam van het besturingssysteem.
SubscriptionId De unieke id voor het Azure-abonnement.
ResourceGroup Naam van de resourcegroep waartoe de resource behoort.
ResourceProvider De resourceprovider.
Resource De naam van de resource.
ResourceId Unieke id voor de resource die is gekoppeld aan de record.
ResourceType Het type van de resource.
ComputerEnvironment Omgeving. Mogelijke waarden zijn Azure of Niet-Azure.
VMUUID Unieke id voor de virtuele machine.
MG Unieke id voor de beheergroep of Log Analytics-werkruimte.
ManagementGroupName Naam van de Operations Manager-beheergroep of de Log Analytics-werkruimte.
MSRCSeverity Ernstclassificatie voor het beveiligingsprobleem. Waarden zijn:
Kritiek
Belangrijk
Gemiddeld
Laag
KBID Knowledge Base-artikel-id voor de Windows-update.
UpdateID Unieke id van de software-update.
RevisionNumber Het revisienummer van een specifieke revisie van een update.
Optioneel Waar als de record optioneel is of anders onwaar is.
RebootBehavior Het gedrag voor opnieuw opstarten na het installeren/verwijderen van een update.
MSRCBulletinID Id-nummer van het beveiligingsbulletin.
Worden goedgekeurd Waar als de record is goedgekeurd of anders onwaar is.
ApprovalSource Alleen van toepassing op het Windows-besturingssysteem. Bron van goedkeuring voor de record. De waarde is Microsoft Update.
InstallTimePredictionSeconds
InstallTimeDeviationRangeSeconds
InstallTimeAvailable
Type Recordtype. De waarde is Bijwerken.

Statusrecord van query-update-implementatie

Er wordt een record met een type UpdateRunProgress gemaakt dat de update-implementatiestatus van een geplande implementatie per machine biedt. Deze records hebben de eigenschappen in de volgende tabel:

Eigenschappen Beschrijving
Tenant-ID Unieke id die het exemplaar van Microsoft Entra-id van uw organisatie vertegenwoordigt.
SourceSystem Bronsysteem voor de record. De waarde is OperationsManager.
TimeGenerated De datum en tijd waarop de record is gemaakt.
MG Unieke id voor de beheergroep of Log Analytics-werkruimte.
ManagementGroupName Naam van de Operations Manager-beheergroep of Log Analytics-werkruimte.
SourceComputerId Unieke id die de broncomputer vertegenwoordigt.
KBID Knowledge Base-artikel-id voor de Windows-update.
UpdateId Unieke id van de software-update.
SucceededOnRetry Waarde die aangeeft of de uitvoering van de update is mislukt bij de eerste poging en de huidige bewerking een nieuwe poging is.
ErrorResult Windows Update-foutcode gegenereerd als een update niet kan worden geïnstalleerd.
UpdateRunName Naam van het updateschema.
InstallationStatus De mogelijke installatiestatussen van een update op de clientcomputer,
NotStarted - taak nog niet geactiveerd.
Failed - de taak is gestart, maar is mislukt met een uitzondering.
InProgress - taak wordt uitgevoerd.
MaintenanceWindowExceeded - als de uitvoering resteerde, maar het interval van het onderhoudsvenster is bereikt.
Succeeded - taak voltooid.
Install Failed - kan de update niet worden geïnstalleerd.
NotIncluded - de bijbehorende updateclassificatie komt niet overeen met de vermeldingen van de klant in de invoerclassificatielijst.
Excluded - gebruiker voert een KBID in uitgesloten lijst in. Als DE KBID in de uitgesloten lijst overeenkomt met de door het systeem gedetecteerde KB-id van de update, wordt deze gemarkeerd als uitgesloten tijdens het patchen.
Computer Volledig gekwalificeerde domeinnaam van rapportagecomputer.
Title De titel van de update.
Product De producten waarvoor de update van toepassing is.
OSType Type besturingssysteem. Waarden zijn Windows of Linux.
StartTime (UTC) Tijdstip waarop de update is gepland om te worden geïnstalleerd. Deze eigenschap wordt momenteel niet gebruikt. Zie TimeGenerated.
EndTime (UTC) Het tijdstip waarop het synchronisatieproces is beëindigd. Deze eigenschap wordt momenteel niet gebruikt. Zie TimeGenerated.
CorrelationId Unieke id van de runbooktaak die wordt uitgevoerd voor de update.
SubscriptionId De unieke id voor het Azure-abonnement.
ResourceGroup Naam van de resourcegroep waartoe de resource behoort.
ResourceProvider De resourceprovider.
Resource De naam van de resource.
ResourceId Unieke id voor de resource die is gekoppeld aan de record.
ResourceType Resourcetype.
ComputerEnvironment Omgeving. Waarden zijn Azure of Niet-Azure.
VMUUID Unieke id voor de virtuele machine.
Type Het type update. De waarde is UpdateRunProgress.
_ResourceId Unieke id voor de resource die is gekoppeld aan de record.

Samenvattingsrecord query-update

Er wordt een record met een type UpdateSummary gemaakt dat een updateoverzicht per computer biedt. Deze records hebben de eigenschappen in de volgende tabel:

Eigenschappen Beschrijving
Tenant-ID Unieke id die het exemplaar van Microsoft Entra-id van uw organisatie vertegenwoordigt.
SourceSystem Bronsysteem voor de record. De waarde is OpsManager.
TimeGenerated De datum en tijd waarop de record is gemaakt.
MG Unieke id voor de beheergroep of Log Analytics-werkruimte.
ManagementGroupName Naam van de Operations Manager-beheergroep of Log Analytics-werkruimte.
SourceComputerId Unieke id voor de virtuele machine.
LastUpdateApplied (UTC)
OldestMissingSecurityUpdateInDays Totaal aantal dagen voor de oudste update gedetecteerd als van toepassing dat niet is geïnstalleerd.
OldestMissingSecurityUpdateBucket Specificeer de oudste ontbrekende beveiligingsbucket. Waarden zijn:
Recent als de waarde kleiner is dan 30 dagen
30 dagen geleden
60 dagen geleden
90 dagen geleden
120 dagen geleden
150 dagen geleden
180 dagen geleden
Ouder wanneer de waarde groter is dan 180 dagen.
WindowsUpdateSetting Status van de Windows Update-agent. Mogelijke waarden zijn:
Scheduled installation
Notify before installation
Error returned from unhealthy WUA agent
WindowsUpdateAgentVersion Versie van de Windows Update-agent.
WSUSServer Fouten als de Windows Update-agent een probleem heeft, om u te helpen bij het oplossen van problemen.
Computer Volledig gekwalificeerde domeinnaam van rapportagecomputer.
OsVersion De versie van het besturingssysteem.
NETRuntimeVersion Versie van .NET Framework geïnstalleerd op de Windows-computer.
CriticalUpdatesMissing Aantal toepasselijke essentiële updates die ontbreken.
SecurityUpdatesMissing Aantal ontbrekende beveiligingsupdates die van toepassing zijn.
OtherUpdatesMissing Aantal gedetecteerde updates ontbreekt.
TotalUpdatesMissing Totaal aantal ontbrekende updates dat van toepassing is.
RestartPending Waar als een herstart in behandeling is of anders onwaar is.
SubscriptionId De unieke id voor het Azure-abonnement.
ResourceGroup Naam van de resourcegroep die de resource bevat.
ResourceProvider De resourceprovider.
Resource Naam van de resource voor de record.
ResourceId Unieke id voor de resource die is gekoppeld aan de record.
ResourceType Resourcetype.
ComputerEnvironment Omgeving. Waarden zijn Azure of Niet-Azure.
VMUUID Unieke id voor de virtuele machine.
Type Recordtype. De waarde is UpdateSummary.
_ResourceId Unieke id voor de resource die is gekoppeld aan de record.

Voorbeeldquery's

De volgende secties bevatten voorbeeldlogboekquery's voor updaterecords die worden verzameld voor Updatebeheer.

Controleer of niet-Azure-machines zijn ingeschakeld voor Updatebeheer

Voer een van de volgende zoekopdrachten uit om te bevestigen dat rechtstreeks verbonden machines communiceren met Azure Monitor-logboeken.

Linux

Heartbeat
| where OSType == "Linux" | summarize arg_max(TimeGenerated, *) by SourceComputerId | top 500000 by Computer asc | render table

Windows

Heartbeat
| where OSType == "Windows" | summarize arg_max(TimeGenerated, *) by SourceComputerId | top 500000 by Computer asc | render table

Op een Windows-computer kunt u de volgende informatie bekijken om de connectiviteit van de agent met Azure Monitor-logboeken te controleren:

  1. Open Microsoft Monitoring Agent in Configuratiescherm. Op het tabblad Azure Log Analytics wordt het volgende bericht weergegeven: De Microsoft Monitoring Agent heeft verbinding gemaakt met Log Analytics.

  2. Open het Windows-gebeurtenislogboek. Ga naar Toepassings- en serviceslogboeken\Operations Manager en zoek naar gebeurtenis-id 3000 en gebeurtenis-id 5002 van de bronservice Verbinding maken or. Deze gebeurtenissen geven aan of de computer is geregistreerd bij de Log Analytics-werkruimte en of deze de configuratie ontvangt.

Als de agent niet kan communiceren met Azure Monitor-logboeken en de agent is geconfigureerd voor communicatie met internet via een firewall of proxyserver, controleert u of de firewall of proxyserver juist is geconfigureerd. Zie Netwerkconfiguratie voor Windows-agent of netwerkconfiguratie voor Linux-agent voor een Linux-agent voor meer informatie over het controleren of de firewall of proxyserver juist is geconfigureerd.

Notitie

Als uw Linux-systemen zijn geconfigureerd om te communiceren met een proxy of Log Analytics Gateway en u Updatebeheer inschakelt, werkt u de proxy.conf machtigingen bij om de omiuser-groep leesmachtigingen voor het bestand te verlenen met behulp van de volgende opdrachten:

sudo chown omsagent:omiusers /etc/opt/microsoft/omsagent/proxy.conf sudo chmod 644 /etc/opt/microsoft/omsagent/proxy.conf

Nieuw toegevoegde Linux-agents geven de status Bijgewerkt weer nadat een evaluatie is uitgevoerd. Dit proces kan maximaal zes uur duren.

Zie Operations Manager-integratie valideren met Azure Monitor-logboeken om te controleren of een Operations Manager-beheergroep communiceert met Azure Monitor-logboeken.

Enkele Azure VM-evaluatiequery's (Windows)

Vervang de WAARDE VAN DE VMUUID door de VM-GUID van de virtuele machine waarop u een query uitvoert. U vindt de VMUUID die moet worden gebruikt door de volgende query uit te voeren in Azure Monitor-logboeken: Update | where Computer == "<machine name>" | summarize by Computer, VMUUID

Samenvatting ontbrekende updates

Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and VMUUID=~"b08d5afa-1471-4b52-bd95-a44fea6e4ca8"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| summarize by UpdateID, Classification
| summarize allUpdatesCount=count(), criticalUpdatesCount=countif(Classification has "Critical"), securityUpdatesCount=countif(Classification has "Security"), otherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security")

Lijst met ontbrekende updates

Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and VMUUID=~"8bf1ccc6-b6d3-4a0b-a643-23f346dfdf82"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Title, KBID, PublishedDate, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| project-away UpdateState, Approved, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), displayName=any(Title), publishedDate=min(PublishedDate), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(UpdateID, "_", KBID), classification=Classification, InformationId=strcat("KB", KBID), InformationUrl=iff(isnotempty(KBID), strcat("https://support.microsoft.com/kb/", KBID), ""), osType=2
| sort by ClassificationWeight desc, computersCount desc, displayName asc
| extend informationLink=(iff(isnotempty(InformationId) and isnotempty(InformationUrl), toobject(strcat('{ "uri": "', InformationUrl, '", "text": "', InformationId, '", "target": "blank" }')), toobject('')))
| project-away ClassificationWeight, InformationId, InformationUrl

Enkele Azure VM-evaluatiequery's (Linux)

Voor sommige Linux-distributies komt een endianness niet overeen met de VMUUID-waarde die afkomstig is van Azure Resource Manager en wat is opgeslagen in Azure Monitor-logboeken. Met de volgende query wordt gecontroleerd op een overeenkomst op een van beide endianiteit. Vervang de VMUUID-waarden door de big-endian- en little-endian-indeling van de GUID om de resultaten correct te retourneren. U vindt de VMUUID die moet worden gebruikt door de volgende query uit te voeren in Azure Monitor-logboeken: Update | where Computer == "<machine name>" | summarize by Computer, VMUUID

Samenvatting ontbrekende updates

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and (VMUUID=~"625686a0-6d08-4810-aae9-a089e68d4911" or VMUUID=~"a0865662-086d-1048-aae9-a089e68d4911")
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by Computer, SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| summarize by Product, ProductArch, Classification
| summarize allUpdatesCount=count(), criticalUpdatesCount=countif(Classification has "Critical"), securityUpdatesCount=countif(Classification has "Security"), otherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security")

Lijst met ontbrekende updates

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and (VMUUID=~"625686a0-6d08-4810-aae9-a089e68d4911" or VMUUID=~"a0865662-086d-1048-aae9-a089e68d4911")
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, BulletinUrl, BulletinID) by Computer, SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| project-away UpdateState, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(Product, "_", ProductArch), displayName=Product, productArch=ProductArch, classification=Classification, InformationId=BulletinID, InformationUrl=tostring(split(BulletinUrl, ";", 0)[0]), osType=1
| sort by ClassificationWeight desc, computersCount desc, displayName asc
| extend informationLink=(iff(isnotempty(InformationId) and isnotempty(InformationUrl), toobject(strcat('{ "uri": "', InformationUrl, '", "text": "', InformationId, '", "target": "blank" }')), toobject('')))
| project-away ClassificationWeight, InformationId, InformationUrl

Evaluatiequery's voor meerdere VM's

Samenvatting van computers

Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(14h) and OSType!="Linux"
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Approved, Optional, Classification) by SourceComputerId, UpdateID
    | distinct SourceComputerId, Classification, UpdateState, Approved, Optional
    | summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed" and (Optional==false or Classification has "Critical" or Classification has "Security") and Approved!=false, iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId
)
on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity, -1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity
| union (Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(5h) and OSType=="Linux"
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by SourceComputerId, Product, ProductArch
    | distinct SourceComputerId, Classification, UpdateState
    | summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed", iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId
)
on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity, -1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity)
| summarize assessedComputersCount=sumif(computersBySeverity, WorstMissingUpdateSeverity>-1), notAssessedComputersCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==-1), computersNeedCriticalUpdatesCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==4), computersNeedSecurityUpdatesCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==2), computersNeedOtherUpdatesCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==1), upToDateComputersCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==0)
| summarize assessedComputersCount=sum(assessedComputersCount), computersNeedCriticalUpdatesCount=sum(computersNeedCriticalUpdatesCount),  computersNeedSecurityUpdatesCount=sum(computersNeedSecurityUpdatesCount), computersNeedOtherUpdatesCount=sum(computersNeedOtherUpdatesCount), upToDateComputersCount=sum(upToDateComputersCount), notAssessedComputersCount=sum(notAssessedComputersCount)
| extend allComputersCount=assessedComputersCount+notAssessedComputersCount

Samenvatting ontbrekende updates

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by Computer, SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| summarize by Product, ProductArch, Classification
| union (Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| summarize by UpdateID, Classification )
| summarize allUpdatesCount=count(), criticalUpdatesCount=countif(Classification has "Critical"), securityUpdatesCount=countif(Classification has "Security"), otherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security")

Lijst met computers

Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions, Computer, ResourceId, ComputerEnvironment, VMUUID) by SourceComputerId
| where Solutions has "updates"
| extend vmuuId=VMUUID, azureResourceId=ResourceId, osType=1, environment=iff(ComputerEnvironment=~"Azure", 1, 2), scopedToUpdatesSolution=true, lastUpdateAgentSeenTime=""
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(5h) and OSType=="Linux" and SourceComputerId in ((Heartbeat
    | where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
    | summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
    | where Solutions has "updates"
    | distinct SourceComputerId))
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Product, Computer, ComputerEnvironment) by SourceComputerId, Product, ProductArch
    | summarize Computer=any(Computer), ComputerEnvironment=any(ComputerEnvironment), missingCriticalUpdatesCount=countif(Classification has "Critical" and UpdateState=~"Needed"), missingSecurityUpdatesCount=countif(Classification has "Security" and UpdateState=~"Needed"), missingOtherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security" and UpdateState=~"Needed"), lastAssessedTime=max(TimeGenerated), lastUpdateAgentSeenTime="" by SourceComputerId
    | extend compliance=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0, 2, 1)
    | extend ComplianceOrder=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0 or missingOtherUpdatesCount > 0, 1, 3)
)
on SourceComputerId
| project id=SourceComputerId, displayName=Computer, sourceComputerId=SourceComputerId, scopedToUpdatesSolution=true, missingCriticalUpdatesCount=coalesce(missingCriticalUpdatesCount, -1), missingSecurityUpdatesCount=coalesce(missingSecurityUpdatesCount, -1), missingOtherUpdatesCount=coalesce(missingOtherUpdatesCount, -1), compliance=coalesce(compliance, 4), lastAssessedTime, lastUpdateAgentSeenTime, osType=1, environment=iff(ComputerEnvironment=~"Azure", 1, 2), ComplianceOrder=coalesce(ComplianceOrder, 2)
| union(Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions, Computer, ResourceId, ComputerEnvironment, VMUUID) by SourceComputerId
| where Solutions has "updates"
| extend vmuuId=VMUUID, azureResourceId=ResourceId, osType=2, environment=iff(ComputerEnvironment=~"Azure", 1, 2), scopedToUpdatesSolution=true, lastUpdateAgentSeenTime=""
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(14h) and OSType!="Linux" and SourceComputerId in ((Heartbeat
    | where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
    | summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
    | where Solutions has "updates"
    | distinct SourceComputerId))
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Title, Optional, Approved, Computer, ComputerEnvironment) by Computer, SourceComputerId, UpdateID
    | summarize Computer=any(Computer), ComputerEnvironment=any(ComputerEnvironment), missingCriticalUpdatesCount=countif(Classification has "Critical" and UpdateState=~"Needed" and Approved!=false), missingSecurityUpdatesCount=countif(Classification has "Security" and UpdateState=~"Needed" and Approved!=false), missingOtherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security" and UpdateState=~"Needed" and Optional==false and Approved!=false), lastAssessedTime=max(TimeGenerated), lastUpdateAgentSeenTime="" by SourceComputerId
    | extend compliance=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0, 2, 1)
    | extend ComplianceOrder=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0 or missingOtherUpdatesCount > 0, 1, 3)
)
on SourceComputerId
| project id=SourceComputerId, displayName=Computer, sourceComputerId=SourceComputerId, scopedToUpdatesSolution=true, missingCriticalUpdatesCount=coalesce(missingCriticalUpdatesCount, -1), missingSecurityUpdatesCount=coalesce(missingSecurityUpdatesCount, -1), missingOtherUpdatesCount=coalesce(missingOtherUpdatesCount, -1), compliance=coalesce(compliance, 4), lastAssessedTime, lastUpdateAgentSeenTime, osType=2, environment=iff(ComputerEnvironment=~"Azure", 1, 2), ComplianceOrder=coalesce(ComplianceOrder, 2) )
| order by ComplianceOrder asc, missingCriticalUpdatesCount desc, missingSecurityUpdatesCount desc, missingOtherUpdatesCount desc, displayName asc
| project-away ComplianceOrder

Lijst met ontbrekende updates

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, BulletinUrl, BulletinID) by SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| project-away UpdateState, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(Product, "_", ProductArch), displayName=Product, productArch=ProductArch, classification=Classification, InformationId=BulletinID, InformationUrl=tostring(split(BulletinUrl, ";", 0)[0]), osType=1
| union(Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Title, KBID, PublishedDate, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| project-away UpdateState, Approved, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), displayName=any(Title), publishedDate=min(PublishedDate), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(UpdateID, "_", KBID), classification=Classification, InformationId=strcat("KB", KBID), InformationUrl=iff(isnotempty(KBID), strcat("https://support.microsoft.com/kb/", KBID), ""), osType=2)
| sort by ClassificationWeight desc, computersCount desc, displayName asc
| extend informationLink=(iff(isnotempty(InformationId) and isnotempty(InformationUrl), toobject(strcat('{ "uri": "', InformationUrl, '", "text": "', InformationId, '", "target": "blank" }')), toobject('')))
| project-away ClassificationWeight, InformationId, InformationUrl

Volgende stappen