検出規則を更新する

名前空間: microsoft.graph.security

重要

Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。

detectionRule オブジェクトのプロパティを更新します。

この API は、次の国内クラウド展開で使用できます。

グローバル サービス 米国政府機関 L4 米国政府機関 L5 (DOD) 21Vianet が運営する中国

アクセス許可

この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。

アクセス許可の種類 最小特権アクセス許可 より高い特権のアクセス許可
委任 (職場または学校のアカウント) CustomDetection.ReadWrite.All 注意事項なし。
委任 (個人用 Microsoft アカウント) サポートされていません。 サポートされていません。
アプリケーション CustomDetection.ReadWrite.All 注意事項なし。

重要

職場または学校アカウントを使用してアクセスを委任するには、サインインしたユーザーに、この操作に必要なアクセス許可を付与するロールが割り当てられている必要があります。 カスタム検出ルールでは、Microsoft Defender XDR 統合ロールベースのアクセス制御 (RBAC) モデルが使用されます。 サポートされているロールは次のとおりです:

  • 検出チューニング (管理) - カスタム検出、アラートのチューニング、侵害の脅威インジケーターなど、Microsoft Defender ポータル内の検出に対する管理アクセスを付与する Microsoft Defender XDR 統合 RBAC アクセス許可。
  • セキュリティ管理者 - Microsoft Defender ポータルとサービス全体の管理アクセス許可を付与する Microsoft Entra ロール
  • セキュリティ オペレーター - Microsoft Entra ロール。 Microsoft Defender for Endpoint で役割ベースのアクセス制御がオフになっている場合にのみ、カスタム検出ルールを管理するのに十分です。 RBAC が構成されている場合は、Defender for Endpoint の セキュリティ設定の管理 アクセス許可も必要です。

特定の Defender ワークロード (Defender for Endpoint、Defender for Office 365 など) のデータを対象とするルールを管理するために、追加のワークロード固有のアクセス許可が必要になる場合があります。 詳細については、「 カスタム検出を管理するために必要なアクセス許可」を参照してください。

HTTP 要求

PATCH /security/rules/detectionRules/{detectionRuleId}

要求ヘッダー

名前 説明
Authorization ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。
Content-Type application/json. 必須です。

要求本文

リクエストの本文には、更新するプロパティの値 のみ を指定します。 要求本文に含まれていない既存のプロパティは、以前の値を維持するか、他のプロパティ値の変更に基づいて再計算されます。

次の表に、更新できるプロパティを示します。

プロパティ 説明
description String ユーザーが指定した検出ルールの説明。
detectionAction microsoft.graph.security.detectionAction このルールによって検出が行われたときに実行されるアクション (作成されたアラートと自動応答アクションなど)。
displayName String ルールの表示名。
isEnabled ブール値 非推奨。 代わりに ステータス を使用してください。 isEnabled プロパティは、2026-10-01 にこのリソースから削除されます。
queryCondition microsoft.graph.security.queryCondition このルールの検出ロジックを定義する高度な捜索クエリ。
schedule microsoft.graph.security.ruleSchedule このルールのトリガー スケジュール。
status microsoft.graph.security.detectionRuleStatus ルールの現在の実行状態。 使用可能な値: enableddisabledautoDisabledunknownFutureValue

応答

成功した場合、このメソッドは応答本文で 200 OK 応答コードと microsoft.graph.security.detectionRule オブジェクトを返します。

要求

次の例は要求を示しています。

PATCH https://graph.microsoft.com/beta/security/rules/detectionRules/office-encoded-powershell
Content-Type: application/json

{
  "status": "disabled",
  "queryCondition": {
    "queryText": "DeviceProcessEvents | where InitiatingProcessFileName in~ ('winword.exe','excel.exe','outlook.exe') | where FileName == 'powershell.exe' | where ProcessCommandLine has '-enc'"
  }
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 200 OK
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.security.detectionRule",
  "id": "office-encoded-powershell",
  "displayName": "Suspicious encoded PowerShell from Office",
  "description": "Detects encoded PowerShell processes launched by Office applications, a common phishing payload pattern.",
  "status": "disabled",
  "createdBy": "alice@contoso.com",
  "createdDateTime": "2026-05-25T10:15:00Z",
  "lastModifiedBy": "alice@contoso.com",
  "lastModifiedDateTime": "2026-05-28T14:30:00Z",
  "queryCondition": {
    "queryText": "DeviceProcessEvents | where InitiatingProcessFileName in~ ('winword.exe','excel.exe','outlook.exe') | where FileName == 'powershell.exe' | where ProcessCommandLine has '-enc'"
  },
  "schedule": {
    "frequency": "PT1H"
  },
  "detectionAction": {
    "alertTemplate": {
      "title": "Suspicious encoded PowerShell from Office",
      "description": "An Office app launched an encoded PowerShell command, which may indicate phishing-driven code execution.",
      "severity": "high",
      "recommendedActions": "Investigate the parent Office document, isolate the device, and review the user's recent email activity.",
      "entityMappings": {
        "accounts": [
          {
            "nameColumn": "AccountName",
            "sidColumn": "AccountSid"
          }
        ]
      },
      "tactics": [
        {
          "tactic": "Execution",
          "techniques": [
            {
              "technique": "T1059.001"
            }
          ]
        }
      ]
    },
    "automatedActions": {
      "isolateDevices": [
        {
          "deviceIdColumn": "DeviceId",
          "isolationType": "full"
        }
      ],
      "initiateInvestigations": [
        {
          "deviceIdColumn": "DeviceId"
        }
      ]
    }
  }
}