Edit

List detectionRule objects

Namespace: microsoft.graph.security

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Get a list of detectionRule objects and their properties.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) CustomDetection.Read.All CustomDetection.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application CustomDetection.Read.All CustomDetection.ReadWrite.All

Important

For delegated access using work or school accounts, the signed-in user must be assigned a role that grants the permissions required for this operation. Custom detection rules use the Microsoft Defender XDR Unified role-based access control (RBAC) model. The following Microsoft Entra roles are supported:

  • Security Reader
  • Global Reader
  • Security Operator
  • Security Administrator

Additional workload-specific read permissions might be required to view rules that target data from specific Defender workloads (for example, Defender for Endpoint, Defender for Office 365). For more information, see Microsoft Defender XDR Unified RBAC.

HTTP request

GET /security/rules/detectionRules

Optional query parameters

This method supports the $select, $top, $skip, $count, $filter, and $orderby OData query parameters to help customize the response. For the per-property list of supported $filter operators and $orderby properties, see detectionRule properties.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a collection of microsoft.graph.security.detectionRule objects in the response body.

Examples

Request

The following example shows a request.

GET https://graph.microsoft.com/beta/security/rules/detectionRules

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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

{
  "value": [
    {
      "@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"
            }
          ]
        }
      }
    }
  ]
}