稽核 Microsoft Sentinel 查詢和活動

本文說明如何檢視 Microsoft Sentinel 工作區中執行的查詢和進行的活動之稽核資料,例如用於您的安全性作業 (SOC) 工作區中的內部與外部合規需求。

Microsoft Sentinel 提供以下存取權限:

  • AzureActivity 表格,提供 Microsoft Sentinel 中所有操作的詳細資訊,例如編輯警示規則。 AzureActivity 資料表不會記錄特定的查詢資料。 如需詳細資訊,請參閱 使用 Azure 活動記錄進行稽核。

  • LAQueryLogs 表格提供 Log Analytics 中執行的查詢細節,包括從 Microsoft Sentinel 執行的查詢。 欲了解更多資訊,請參閱 《使用LAQueryLogs的審計》。

提示

除了本文所述的手動查詢外,我們建議您使用內建的 Workspace 稽核 工作簿,協助您審核 SOC 環境中的活動。 欲了解更多資訊,請參閱 Microsoft Sentinel 中的「使用工作簿視覺化並監控您的資料」。

必要條件

用 Azure 活動日誌進行審計

Microsoft Sentinel 的稽核日誌會保存在 Azure 活動日誌中,AzureActivity 表格會記錄你在 Microsoft Sentinel 工作空間中執行的所有動作。

在使用 Microsoft Sentinel 審核 SOC 環境中的活動時,請使用 AzureActivity 表格。

查詢 AzureActivity 表格:

  1. 安裝 適用於 Sentinel 的 Azure Activity 解決方案,並連接 Azure Activity 資料連接器,開始將稽核事件串流至名為 AzureActivity 的新資料表。

  2. 像查詢其他資料表一樣,使用 Kusto 查詢語言 (KQL) 查詢資料:

    • 在 Azure 入口網站的記錄頁面中,查詢此資料表。
    • 在 Defender 入口網站,請在 調查 & 回應 > 「狩獵 >進階狩獵 」頁面查詢此表。

    AzureActivity 資料表包含許多服務的資料,包括 Microsoft Sentinel。 請使用以下查詢篩選 AzureActivity 表格,使其僅顯示 Microsoft Sentinel 操作:

     AzureActivity
    | where OperationNameValue startswith "MICROSOFT.SECURITYINSIGHTS"
    

    例如,要查詢最後一位編輯特定分析規則的使用者,請使用以下查詢 (替換 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 為你想檢查的規則 ID) :

    AzureActivity
    | where OperationNameValue startswith "MICROSOFT.SECURITYINSIGHTS/ALERTRULES/WRITE"
    | where Properties contains "alertRules/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    | project Caller , TimeGenerated , Properties
    

根據您需要回報的內容,在查詢中加入更多參數以進一步探索 AzureActivities 表格。 以下各節提供其他範例查詢,供使用 AzureActivity 資料表資料進行稽核時參考。

欲了解更多資訊,請參閱 Azure 活動日誌中包含的 Microsoft Sentinel 資料。

查找特定使用者在過去 24 小時內所採取的所有行動

以下 AzureActivity 表格查詢列出特定 Microsoft Entra 使用者在過去 24 小時內所採取的所有操作。

AzureActivity
| where OperationNameValue contains "SecurityInsights"
| where Caller == "[AzureAD username]"
| where TimeGenerated > ago(1d)

查找所有刪除操作

要找出被刪除的 Microsoft Sentinel 資源,請執行以下查詢,以篩選 Azure 活動日誌中成功刪除作業的紀錄。

AzureActivity
| where OperationNameValue contains "SecurityInsights"
| where OperationName contains "Delete"
| where ActivityStatusValue contains "Succeeded"
| project TimeGenerated, Caller, OperationName

Azure 活動記錄中包含的 Microsoft Sentinel 資料

Microsoft Sentinel 的稽核日誌會保存在 Azure 活動日誌中,並包含以下類型的資訊:

作業 資訊類型
建立時間 警報規則
案件評論
事件評論
已儲存的搜尋
觀察名單
Workbooks
Deleted 警報規則
書籤
資料連接器
事件
已儲存的搜尋
設定
威脅情報報告
觀察名單
Workbooks
Workflow
Updated 警報規則
書籤
案例
資料連接器
事件
事件評論
威脅情報報告
Workbooks
Workflow

你也可以使用 Azure 活動日誌來檢查使用者授權和授權。 例如,以下表格列出了 Azure 活動日誌中選取的操作,並列出日誌資料所取的特定資源。

營運名稱 資源類型
建立或更新工作簿 Microsoft.Insights/workbooks
刪除工作簿 Microsoft.Insights/workbooks
設定工作流程 Microsoft.Logic/工作流程
刪除工作流程 Microsoft.Logic/工作流程
建立已儲存的搜尋 Microsoft.OperationalInsights/workspaces/savedSearches
刪除已儲存的搜尋 Microsoft.OperationalInsights/workspaces/savedSearches
更新警報規則 Microsoft.SecurityInsights/alertRules
刪除警報規則 Microsoft.SecurityInsights/alertRules
更新警報規則回應動作 Microsoft.SecurityInsights/alertRules/actions
刪除警報規則回應動作 Microsoft.SecurityInsights/alertRules/actions
更新書籤 Microsoft.SecurityInsights/bookmarks
刪除書籤 Microsoft.SecurityInsights/bookmarks
更新案例 Microsoft.SecurityInsights/Cases
更新案件調查 Microsoft.SecurityInsights/案例/調查
建立案件評論 Microsoft.SecurityInsights/案例/評論
更新資料連接器 Microsoft.SecurityInsights/dataConnectors
刪除資料連接器 Microsoft.SecurityInsights/dataConnectors
更新設定 Microsoft.SecurityInsights/settings

欲了解更多資訊,請參閱 Azure 活動日誌事件結構。

使用 LAQueryLogs 進行稽核

LAQueryLogs 表格提供在 Log Analytics 中執行的日誌查詢細節。 由於 Log Analytics 是 Microsoft Sentinel 底層資料庫,你可以設定系統在 Microsoft Sentinel 工作空間中收集 LAQueryLogs 資料。

LAQueryLogs 的資料包括以下資訊:

  • 執行查詢時
  • 誰在 Log Analytics 中執行查詢
  • 在 Log Analytics 中執行查詢的工具是什麼,例如 Microsoft Sentinel
  • 查詢文字本身
  • 每次執行查詢的效能資料

注意事項

  • The LAQueryLogs 資料表僅包含在 Microsoft Sentinel「記錄」刀鋒視窗中執行的查詢。 它不包含由排程分析規則執行的查詢、使用 Investigation Graph 時執行的查詢、在 Microsoft Sentinel 的 搜捕 頁面中執行的查詢,或在 Defender 入口網站的 進階搜捕 頁面中執行的查詢。

  • 查詢執行與資料填入 LAQueryLogs 資料表之間可能會有短暫延遲。 我們建議等待約 5 分鐘,再查詢 LAQueryLogs 表格以取得稽核資料。

要查詢 LAQueryLogs 表格:

  1. LAQueryLogs 表格在您的 Log Analytics 工作區中預設未啟用。 要在 Microsoft Sentinel 進行稽核時使用 LAQueryLogs 資料,請先在你的 Log Analytics 工作區的診斷設定中啟用 LAQueryLogs。

    欲了解更多資訊,請參閱 Azure 監視器 日誌中的稽核查詢。

  2. 然後,像查詢其他資料表一樣,使用 KQL 查詢資料。

    例如,以下查詢顯示過去一週每天執行了多少查詢:

    LAQueryLogs
    | where TimeGenerated > ago(7d)
    | summarize events_count=count() by bin(TimeGenerated, 1d)
    

以下章節顯示更多範例查詢,說明在使用 Microsoft Sentinel 稽核 SOC 環境中的活動時,可在 LAQueryLogs 資料表上執行哪些查詢。

回應不是「OK」的查詢執行次數

請使用以下查詢來計算回傳非成功回應碼的 Log Analytics 查詢。 此計數包含未能執行或只回傳 HTTP 200 OK 回應的查詢。

LAQueryLogs
| where ResponseCode != 200 
| count 

顯示 CPU 密集型查詢的使用者

要找到執行最耗資源查詢的使用者或用戶端,請使用以下查詢,依 CPU 時間所佔排序,顯示每個 Microsoft Entra 用戶端 ID 中最高 CPU 時間的查詢。

LAQueryLogs
|summarize arg_max(StatsCPUTimeMs, *) by AADClientId
| extend User = AADEmail, QueryRunTime = StatsCPUTimeMs
| project User, QueryRunTime, QueryText
| sort by QueryRunTime desc

顯示過去一週查詢次數最多的使用者

請使用以下查詢摘要每位使用者在過去七天內執行了多少查詢,有助於辨識工作空間中最活躍的使用者,以便進行稽核或使用分析。

LAQueryLogs
| where TimeGenerated > ago(7d)
| summarize events_count=count() by AADEmail
| extend UserPrincipalName = AADEmail, Queries = events_count
| join kind= leftouter (
    SigninLogs)
    on UserPrincipalName
| project UserDisplayName, UserPrincipalName, Queries
| summarize arg_max(Queries, *) by UserPrincipalName
| sort by Queries desc

設定 Microsoft Sentinel 活動的警示

你或許可以使用 Microsoft Sentinel 的稽核資源來建立主動式警報。

例如,如果你在 Microsoft Sentinel 工作空間中有敏感資料表,你可以偵測這些資料表何時被存取。 以下查詢透過列出過去 24 小時內引用該資料表的查詢,來審核對特定敏感資料表的存取權限。 請將你想監控的資料表名稱替換 [Name of sensitive table] 為:

LAQueryLogs
| where QueryText contains "[Name of sensitive table]"
| where TimeGenerated > ago(1d)
| extend User = AADEmail, Query = QueryText
| project User, Query

使用 Workbooks、規則和劇本監視 Microsoft Sentinel

使用 Microsoft Sentinel 自有功能來監控 Microsoft Sentinel 內發生的事件與動作。

  • 使用活頁簿進行監視。 數本內建的 Microsoft Sentinel 工作簿能協助你監控工作空間活動,包括工作區使用者資訊、所使用的分析規則、最常涵蓋的 MITRE 策略、停滯或停止的匯入,以及 SOC 團隊的效能。

    欲了解更多資訊,請參閱「透過使用工作簿在 Microsoft Sentinel 中視覺化並監控您的資料」及「常用 Microsoft Sentinel 工作簿」

  • 留意資料擷取延遲。 如果你擔心資料擷取延遲,可以在 分析規則中設定 一個變數來代表延遲。

    例如,以下分析規則可確保結果不包含重複,且執行規則時不會遺漏日誌:

    let ingestion_delay= 2min;let rule_look_back = 5min;CommonSecurityLog| where TimeGenerated >= ago(ingestion_delay + rule_look_back)| where ingestion_time() > (rule_look_back)
    - Calculating ingestion delay
      CommonSecurityLog| extend delay = ingestion_time() - TimeGenerated| summarize percentiles(delay,95,99) by DeviceVendor, DeviceProduct
    

    欲了解更多資訊,請參閱 Microsoft Sentinel 中的自動化事件處理與自動化規則。

  • 使用連接器健康情況推播通知解決方案劇本監視資料連接器的健康情況,以留意資料擷取停滯或停止的情況,並在連接器停止收集資料或電腦停止回報時傳送通知。

請參閱本文中 KQL 範例中使用的 Kusto 文件:

欲了解更多關於KQL的資訊,請參閱Kusto 查詢語言 (KQL) 概述。

其他資源:

下一步

在 Microsoft Sentinel 中,使用 Workspace 稽核工作簿來稽核 SOC 環境中的活動。 欲了解更多資訊,請參閱 「視覺化與監控您的資料」。