使用本機上線或離線腳本時建立通知規則
適用於:
想要體驗適用於端點的 Microsoft Defender 嗎? 注册免費試用版。
注意事項
如果您是美國政府客戶,請使用 適用於美國政府客戶的 Microsoft Defender 中所列的 URI。
提示
為了獲得更好的效能,您可以使用更接近您地理位置的伺服器:
- us.api.security.microsoft.com
- eu.api.security.microsoft.com
- uk.api.security.microsoft.com
- au.api.security.microsoft.com
- swa.api.security.microsoft.com
- ina.api.security.microsoft.com
建立通知規則,以便在使用本機上線或離線腳本時通知您。
開始之前
您必須具有下列權限:
- Power Automate (每位使用者方案至少) 。 如需詳細資訊,請參閱 Power Automate定價頁面。
- Azure 數據表或 SharePoint 清單或連結庫/SQL DB。
建立通知流程
流覽至 [我的流程 > 新增 > 已排程 - 從空白]。
建置排程流程。
- 輸入流程名稱。
- 指定開始和時間。
- 指定頻率。 例如,每隔 5 分鐘。
選取 [+] 按鈕以新增動作。 新的動作是針對適用於端點的Defender裝置API提出的 HTTP 要求。 您也可以將它取代為現成可用的 WDATP 連接器 (動作: 機器 - 取得) 的計算機清單 。
輸入下列 HTTP 欄位:
- 方法: GET 作為取得裝置清單的值。
- URI: 輸入
https://api.securitycenter.microsoft.com/api/machines
。 - 驗證:選取 [Active Directory OAuth]。
- 租使用者:登入 https://portal.azure.com 並流覽至 Microsoft Entra ID > 應用程式註冊 ],並取得租用戶標識碼值。
- 觀眾:
https://securitycenter.onmicrosoft.com/windowsatpservice\
- 用戶端標識碼:登入 https://portal.azure.com 並流覽至 Microsoft Entra ID > 應用程式註冊 ],並取得 [用戶端識別符] 值。
- 認證類型:選取 [秘密]。
- 秘密:登入 https://portal.azure.com 並流覽至 Microsoft Entra ID > 應用程式註冊 ],並取得租用戶標識碼值。
選取 [ 新增動作 ],然後搜尋 [數據作業 ],然後選取 [ 剖析 JSON],以新增步驟。
在 [內容] 欄 位中新增本文。
選取 [使用範例承載來產生架構 ] 連結。
複製並貼上下列 JSON 代碼段:
{ "type": "object", "properties": { "@@odata.context": { "type": "string" }, "value": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "computerDnsName": { "type": "string" }, "firstSeen": { "type": "string" }, "lastSeen": { "type": "string" }, "osPlatform": { "type": "string" }, "osVersion": {}, "lastIpAddress": { "type": "string" }, "lastExternalIpAddress": { "type": "string" }, "agentVersion": { "type": "string" }, "osBuild": { "type": "integer" }, "healthStatus": { "type": "string" }, "riskScore": { "type": "string" }, "exposureScore": { "type": "string" }, "aadDeviceId": {}, "machineTags": { "type": "array" } }, "required": [ "id", "computerDnsName", "firstSeen", "lastSeen", "osPlatform", "osVersion", "lastIpAddress", "lastExternalIpAddress", "agentVersion", "osBuild", "healthStatus", "rbacGroupId", "rbacGroupName", "riskScore", "exposureScore", "aadDeviceId", "machineTags" ] } } } }
從 JSON 呼叫擷取值,並檢查已上線的裝置是否已在 SharePoint 清單中註冊/,例如:
- 如果是,則不會觸發任何通知
- 如果沒有,將會在 SharePoint 清單中註冊新上線的裝置,並將通知傳送給適用於端點的 Defender 系統管理員
在 [條件] 底下,新增下列表達式:「長度 (本文 ('Get_items') ?['value']) ],並將條件設定為等於 0。
警示通知
下圖是電子郵件通知的範例。
提示
您可以在這裡使用 lastSeen 進行篩選:
- 每 60 分鐘:
- 取用過去七天內看到的所有裝置。
- 每 60 分鐘:
針對每個裝置:
- 如果上次看到的屬性是以 [-7 天, -7days + 60 分鐘] 的一小時間隔為 -> 脫機可能性的警示。
- 如果第一次看到是在過去一小時 -> 上線的警示。
在此解決方案中,您沒有重複的警示。
租用戶有許多裝置。 取得所有這些裝置可能需要分頁。
您可以將它分割成兩個查詢:
針對下架,使用 OData $filter只會採用此間隔,而且只有在符合條件時才會通知。
擷取過去一小時內看到的所有裝置,並檢查其第一次看見的屬性 (如果第一個看到的屬性是在過去一小時,最後一個看到的必須太) 。
提示
想要深入了解? 在我們的技術社群中與Microsoft安全性社群互動:Microsoft適用於端點的Defender技術社群。