选择一个答案
点击一个选项来检查您的答案。
正确答案: resources | where type =~ 'microsoft.hybridcompute/machines' | project id, name, resourceGroup, location | join kind=leftanti (resources | where type =~ 'microsoft.hybridcompute/machines/extensions' and name in~('AzureMonitorWindowsAgent','AzureMonitorLinuxAgent') | project machineId = tostring(split(id, '/extensions/')[0])) on $left.id == $right.machineId | join kind=leftouter (resources | where type =~ 'microsoft.guestconfiguration/guestconfigurationassignments' | project machineId = tostring(split(id, '/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/')[0]), assignmentName = name, compliance = tostring(properties.complianceStatus)) on $left.id == $right.machineId.
为什么这是答案
正确答案使用 leftanti 连接查找缺少 Azure Monitor Agent 扩展(AzureMonitorWindowsAgent 或 AzureMonitorLinuxAgent)的已启用 Arc 的服务器。leftanti 连接确保只返回左侧表中在右侧表中没有匹配项的记录。然后,它使用 leftouter 连接将这些服务器与它们的来宾配置分配(microsoft.guestconfiguration/guestconfigurationassignments)连接起来,以显示合规性状态。leftouter 连接确保即使没有来宾配置分配,服务器也会被列出。
其他选项不正确:
选项2查询的是 Azure 虚拟机和策略状态,而不是已启用 Arc 的服务器和其扩展。
选项3查询的是扩展中包含“MMA”的资源,并且与 Azure 虚拟机连接,不符合查找缺少 Azure Monitor Agent 扩展的已启用 Arc 的服务器的需求。
选项4查询的是 Log Analytics 工作区,与题目要求无关。