審計 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. 安裝 Azure Activity 解決方案 for Sentinel 解決方案,並連接 Azure Activity 資料連接器,開始將審計事件串流到一個名為 . 的新表格中。AzureActivity

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

    • 在 Azure 入口網站,請查詢此表格的日誌頁面。
    • 在 Defender 入口網站,請在 調查 & 回應 > 「狩獵 >進階狩獵 」頁面查詢此表。

    AzureActivity 資料表包含許多服務的資料,包括 Microsoft Sentinel。 若要只篩選 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)

查找所有刪除操作

以下 AzureActivity 表格查詢列出您在 Microsoft Sentinel 工作空間中執行的所有刪除操作。

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

Microsoft Sentinel data 包含於 Azure Activity logs

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

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

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

營運名稱 資源類型
建立或更新工作簿 Microsoft.Insights/工作簿
刪除工作簿 Microsoft.Insights/工作簿
設定工作流程 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(微軟)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
  • 查詢文本本身
  • 每次查詢執行的效能資料

注意事項

  • LAQueryLogs 表格僅包含在 Microsoft Sentinel 的 Logs 刀片中執行過的查詢。 它不包含由排程分析規則執行的查詢,如調查譜、Microsoft Sentinel 狩獵頁面,或 Defender 入口網站的進階狩獵頁面。

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

要查詢 LAQueryLogs 表格

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

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

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

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

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

以下章節展示了更多範例查詢,供在使用 Microsoft Sentinel 審計 SOC 環境中活動時,在 LAQueryLogs 表格上執行。

有多少查詢的回應不是「OK」

以下 LAQueryLogs 表格查詢顯示執行的查詢次數,其中收到的 HTTP 回應不是 200 OK 。 例如,這個數字包含了那些未能執行的查詢。

LAQueryLogs
| where ResponseCode != 200 
| count 

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

以下 LAQueryLogs 表格查詢列出了執行 CPU 使用量最高的查詢的使用者,依據 CPU 使用量與查詢時間長度。

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

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

以下 LAQueryLogs 表格查詢列出過去一週執行查詢次數最多的使用者。

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 工作區有敏感資料表,請使用以下查詢,每次查詢這些資料表時都會通知您:

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

監控 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 中的自動化事件處理與自動化規則

  • 使用 Connector Health Push Notification Solution 操作手冊監控資料連接器健康狀況,監控資料擷取卡頓或停止擷取,並在連接器停止收集資料或機器停止回報時發送通知。

請參閱 Kusto 文件中前述範例中使用的以下項目的更多資訊:

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

其他資源:

下一步

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