名前空間: microsoft.graph.security
新しい detectionRule オブジェクトを作成します。
アクセス許可
この 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 要求
POST /security/rules/detectionRules
要求ヘッダー
| 名前 | 説明 |
|---|---|
| Authorization | ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。 |
| Content-Type | application/json. 必須です。 |
要求本文
要求本文には、 microsoft.graph.security.detectionRule オブジェクトの JSON 表現を指定します。
detectionRule を作成するときに、次のプロパティとリレーションシップを指定できます。
| プロパティ | 型 | 説明 |
|---|---|---|
| description | String | ユーザーが指定した検出ルールの説明。 省略可能。 |
| detectionAction | microsoft.graph.security.detectionAction | このルールによって検出が行われたときに実行されるアクション (作成されたアラートと自動応答アクションなど)。 必須です。 |
| displayName | String | ルールの表示名。 必須。 |
| id | 文字列 | クライアント指定のルールの一意識別子。 必須です。 |
| queryCondition | microsoft.graph.security.queryCondition | このルールの検出ロジックを定義する高度な捜索クエリ。 必須です。 |
| schedule | microsoft.graph.security.ruleSchedule | このルールのトリガー スケジュール。 必須です。 |
| status | microsoft.graph.security.detectionRuleStatus | ルールの現在の実行状態。 使用可能な値: enabled、disabled、autoDisabled、unknownFutureValue。 必須です。 |
応答
成功した場合、このメソッドは応答本文で 201 Created 応答コードと microsoft.graph.security.detectionRule オブジェクトを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/v1.0/security/rules/detectionRules
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": "enabled",
"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",
"ntDomainColumn": "AccountDomain",
"sidColumn": "AccountSid"
}
],
"hosts": [
{
"deviceIdColumn": "DeviceId",
"nameColumn": "DeviceName"
}
],
"files": [
{
"nameColumn": "FileName",
"sha1Column": "SHA1",
"sha256Column": "SHA256"
}
]
},
"tactics": [
{
"tactic": "Execution",
"techniques": [
{
"technique": "T1059.001"
}
]
}
]
}
}
}
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
Location: https://graph.microsoft.com/v1.0/security/rules/detectionRules/office-encoded-powershell
{
"@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": "enabled",
"createdBy": "alice@contoso.com",
"createdDateTime": "2026-05-25T10:15:00Z",
"lastModifiedBy": "alice@contoso.com",
"lastModifiedDateTime": "2026-05-25T10:15: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"
}
]
}
}
}