Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Dataverse - Mass deletion of records

Back
Id716cf6d4-97ad-407b-923e-6790083acb58
RulenameDataverse - Mass deletion of records
DescriptionIdentifies large scale record delete operations based on a predefined threshold and also detects scheduled bulk deletion jobs.
SeverityMedium
TacticsImpact
TechniquesT1485
Required data connectorsDataverse
KindScheduled
Query frequency1h
Query period14d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Dataverse - Mass deletion of records.yaml
Version3.2.0
Arm template716cf6d4-97ad-407b-923e-6790083acb58.json
Deploy To Azure
let mass_delete_threshold = 10000;
let query_frequency = 1d;
let delete_activities = DataverseActivity
    | where TimeGenerated >= ago(query_frequency)
    | where Message == "Delete";
union
    (
    delete_activities
    | summarize FirstEvent = min(TimeGenerated), TotalEvents = count() by UserId, InstanceUrl
    | where TotalEvents > mass_delete_threshold
    | join kind=inner (
        delete_activities
        | summarize DeleteCount = count() by UserId, InstanceUrl, ClientIp, EntityName)
        on UserId, InstanceUrl
    | extend Entities = bag_pack("Entity", EntityName, "Count", DeleteCount)
    | summarize Details = make_set(Entities, 100), FirstEvent = min(FirstEvent) by UserId, InstanceUrl, ClientIp, TotalEvents
    ),
    (
    DataverseActivity
    | where TimeGenerated >= ago(query_frequency)
    | where Message == "BulkDelete"
    | summarize FirstEvent = min(TimeGenerated), TotalEvents = count() by UserId, InstanceUrl, ClientIp
    | extend Details = todynamic("Bulk delete scheduled")
    )
| extend
    CloudAppId = int(32780),
    AccountName = tostring(split(UserId, '@')[0]),
    UPNSuffix = tostring(split(UserId, '@')[1])
| project
    FirstEvent,
    UserId,
    ClientIp,
    TotalEvents,
    Details,
    InstanceUrl,
    CloudAppId,
    AccountName,
    UPNSuffix
entityMappings:
- entityType: Account
  fieldMappings:
  - identifier: Name
    columnName: AccountName
  - identifier: UPNSuffix
    columnName: UPNSuffix
- entityType: CloudApplication
  fieldMappings:
  - identifier: AppId
    columnName: CloudAppId
  - identifier: InstanceName
    columnName: InstanceUrl
- entityType: IP
  fieldMappings:
  - identifier: Address
    columnName: ClientIp
queryFrequency: 1h
name: Dataverse - Mass deletion of records
alertDetailsOverride:
  alertDisplayNameFormat: 'Dataverse - mass deletion or bulk deletion job detected in {{InstanceUrl}} '
  alertDescriptionFormat: '{{UserId}} triggered the mass deletion detection with the following information: {{Details}}'
kind: Scheduled
tactics:
- Impact
triggerThreshold: 0
query: |
  let mass_delete_threshold = 10000;
  let query_frequency = 1d;
  let delete_activities = DataverseActivity
      | where TimeGenerated >= ago(query_frequency)
      | where Message == "Delete";
  union
      (
      delete_activities
      | summarize FirstEvent = min(TimeGenerated), TotalEvents = count() by UserId, InstanceUrl
      | where TotalEvents > mass_delete_threshold
      | join kind=inner (
          delete_activities
          | summarize DeleteCount = count() by UserId, InstanceUrl, ClientIp, EntityName)
          on UserId, InstanceUrl
      | extend Entities = bag_pack("Entity", EntityName, "Count", DeleteCount)
      | summarize Details = make_set(Entities, 100), FirstEvent = min(FirstEvent) by UserId, InstanceUrl, ClientIp, TotalEvents
      ),
      (
      DataverseActivity
      | where TimeGenerated >= ago(query_frequency)
      | where Message == "BulkDelete"
      | summarize FirstEvent = min(TimeGenerated), TotalEvents = count() by UserId, InstanceUrl, ClientIp
      | extend Details = todynamic("Bulk delete scheduled")
      )
  | extend
      CloudAppId = int(32780),
      AccountName = tostring(split(UserId, '@')[0]),
      UPNSuffix = tostring(split(UserId, '@')[1])
  | project
      FirstEvent,
      UserId,
      ClientIp,
      TotalEvents,
      Details,
      InstanceUrl,
      CloudAppId,
      AccountName,
      UPNSuffix  
relevantTechniques:
- T1485
triggerOperator: gt
queryPeriod: 14d
eventGroupingSettings:
  aggregationKind: AlertPerResult
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Dataverse - Mass deletion of records.yaml
severity: Medium
status: Available
id: 716cf6d4-97ad-407b-923e-6790083acb58
requiredDataConnectors:
- connectorId: Dataverse
  dataTypes:
  - DataverseActivity
version: 3.2.0
description: Identifies large scale record delete operations based on a predefined threshold and also detects scheduled bulk deletion jobs.
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/716cf6d4-97ad-407b-923e-6790083acb58')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/716cf6d4-97ad-407b-923e-6790083acb58')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "{{UserId}} triggered the mass deletion detection with the following information: {{Details}}",
          "alertDisplayNameFormat": "Dataverse - mass deletion or bulk deletion job detected in {{InstanceUrl}} "
        },
        "alertRuleTemplateName": "716cf6d4-97ad-407b-923e-6790083acb58",
        "customDetails": null,
        "description": "Identifies large scale record delete operations based on a predefined threshold and also detects scheduled bulk deletion jobs.",
        "displayName": "Dataverse - Mass deletion of records",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "AccountName",
                "identifier": "Name"
              },
              {
                "columnName": "UPNSuffix",
                "identifier": "UPNSuffix"
              }
            ]
          },
          {
            "entityType": "CloudApplication",
            "fieldMappings": [
              {
                "columnName": "CloudAppId",
                "identifier": "AppId"
              },
              {
                "columnName": "InstanceUrl",
                "identifier": "InstanceName"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "ClientIp",
                "identifier": "Address"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "AlertPerResult"
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Dataverse - Mass deletion of records.yaml",
        "query": "let mass_delete_threshold = 10000;\nlet query_frequency = 1d;\nlet delete_activities = DataverseActivity\n    | where TimeGenerated >= ago(query_frequency)\n    | where Message == \"Delete\";\nunion\n    (\n    delete_activities\n    | summarize FirstEvent = min(TimeGenerated), TotalEvents = count() by UserId, InstanceUrl\n    | where TotalEvents > mass_delete_threshold\n    | join kind=inner (\n        delete_activities\n        | summarize DeleteCount = count() by UserId, InstanceUrl, ClientIp, EntityName)\n        on UserId, InstanceUrl\n    | extend Entities = bag_pack(\"Entity\", EntityName, \"Count\", DeleteCount)\n    | summarize Details = make_set(Entities, 100), FirstEvent = min(FirstEvent) by UserId, InstanceUrl, ClientIp, TotalEvents\n    ),\n    (\n    DataverseActivity\n    | where TimeGenerated >= ago(query_frequency)\n    | where Message == \"BulkDelete\"\n    | summarize FirstEvent = min(TimeGenerated), TotalEvents = count() by UserId, InstanceUrl, ClientIp\n    | extend Details = todynamic(\"Bulk delete scheduled\")\n    )\n| extend\n    CloudAppId = int(32780),\n    AccountName = tostring(split(UserId, '@')[0]),\n    UPNSuffix = tostring(split(UserId, '@')[1])\n| project\n    FirstEvent,\n    UserId,\n    ClientIp,\n    TotalEvents,\n    Details,\n    InstanceUrl,\n    CloudAppId,\n    AccountName,\n    UPNSuffix\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "P14D",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Impact"
        ],
        "techniques": [
          "T1485"
        ],
        "templateVersion": "3.2.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}