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

Dataverse - Mass record updates

Back
Iddf577f0f-1d8a-4420-9057-a07f0edb15c8
RulenameDataverse - Mass record updates
DescriptionThis query detects mass record update changes in Dataverse and Dynamics 365, exceeding a pre-defined threshold.
SeverityMedium
TacticsImpact
TechniquesT1641
T1485
T1565
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 record updates.yaml
Version3.2.0
Arm templatedf577f0f-1d8a-4420-9057-a07f0edb15c8.json
Deploy To Azure
// Set threshold for number of updated records
let detection_threshold = 10000;
let query_frequency = 1h;
DataverseActivity
| where TimeGenerated >= ago(query_frequency)
| where Message == "Update"
| summarize EventCount = count() by InstanceUrl, UserId, ClientIp, Message
| where EventCount > detection_threshold
| join kind=inner(
    DataverseActivity
    | where TimeGenerated >= ago(query_frequency))
    on InstanceUrl, UserId, ClientIp, Message
| mv-expand Fields
| summarize
    UpdatedFields = make_set(Fields.Name, 100),
    FirstEvent = min(TimeGenerated)
    by UserId, ClientIp, InstanceUrl, EventCount, EntityName
| extend Details = bag_pack("Entity", EntityName, "Count", EventCount, "FieldsUpdated", UpdatedFields)
| summarize
    TotalEvents = sum(EventCount),
    FirstEvent = min(FirstEvent),
    Details = make_list(Details, 100)
    by UserId, ClientIp, InstanceUrl
| 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: IP
  fieldMappings:
  - identifier: Address
    columnName: ClientIp
- entityType: CloudApplication
  fieldMappings:
  - identifier: AppId
    columnName: CloudAppId
  - identifier: InstanceName
    columnName: InstanceUrl
queryFrequency: 1h
name: Dataverse - Mass record updates
alertDetailsOverride:
  alertDisplayNameFormat: 'Dataverse - Mass record changes detected in {{{InstanceUrl}} '
  alertDescriptionFormat: A total of {{TotalEvents}} records were updated by {{UserId}} , breaching the mass update threshold in {{InstanceUrl}} .
kind: Scheduled
tactics:
- Impact
triggerThreshold: 0
query: |
  // Set threshold for number of updated records
  let detection_threshold = 10000;
  let query_frequency = 1h;
  DataverseActivity
  | where TimeGenerated >= ago(query_frequency)
  | where Message == "Update"
  | summarize EventCount = count() by InstanceUrl, UserId, ClientIp, Message
  | where EventCount > detection_threshold
  | join kind=inner(
      DataverseActivity
      | where TimeGenerated >= ago(query_frequency))
      on InstanceUrl, UserId, ClientIp, Message
  | mv-expand Fields
  | summarize
      UpdatedFields = make_set(Fields.Name, 100),
      FirstEvent = min(TimeGenerated)
      by UserId, ClientIp, InstanceUrl, EventCount, EntityName
  | extend Details = bag_pack("Entity", EntityName, "Count", EventCount, "FieldsUpdated", UpdatedFields)
  | summarize
      TotalEvents = sum(EventCount),
      FirstEvent = min(FirstEvent),
      Details = make_list(Details, 100)
      by UserId, ClientIp, InstanceUrl
  | 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:
- T1641
- T1485
- T1565
triggerOperator: gt
customDetails:
  Details: Details
queryPeriod: 14d
eventGroupingSettings:
  aggregationKind: AlertPerResult
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Dataverse - Mass record updates.yaml
severity: Medium
status: Available
id: df577f0f-1d8a-4420-9057-a07f0edb15c8
requiredDataConnectors:
- connectorId: Dataverse
  dataTypes:
  - DataverseActivity
version: 3.2.0
description: This query detects mass record update changes in Dataverse and Dynamics 365, exceeding a pre-defined threshold.
{
  "$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/df577f0f-1d8a-4420-9057-a07f0edb15c8')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/df577f0f-1d8a-4420-9057-a07f0edb15c8')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "A total of {{TotalEvents}} records were updated by {{UserId}} , breaching the mass update threshold in {{InstanceUrl}} .",
          "alertDisplayNameFormat": "Dataverse - Mass record changes detected in {{{InstanceUrl}} "
        },
        "alertRuleTemplateName": "df577f0f-1d8a-4420-9057-a07f0edb15c8",
        "customDetails": {
          "Details": "Details"
        },
        "description": "This query detects mass record update changes in Dataverse and Dynamics 365, exceeding a pre-defined threshold.",
        "displayName": "Dataverse - Mass record updates",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "AccountName",
                "identifier": "Name"
              },
              {
                "columnName": "UPNSuffix",
                "identifier": "UPNSuffix"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "ClientIp",
                "identifier": "Address"
              }
            ]
          },
          {
            "entityType": "CloudApplication",
            "fieldMappings": [
              {
                "columnName": "CloudAppId",
                "identifier": "AppId"
              },
              {
                "columnName": "InstanceUrl",
                "identifier": "InstanceName"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "AlertPerResult"
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Dataverse - Mass record updates.yaml",
        "query": "// Set threshold for number of updated records\nlet detection_threshold = 10000;\nlet query_frequency = 1h;\nDataverseActivity\n| where TimeGenerated >= ago(query_frequency)\n| where Message == \"Update\"\n| summarize EventCount = count() by InstanceUrl, UserId, ClientIp, Message\n| where EventCount > detection_threshold\n| join kind=inner(\n    DataverseActivity\n    | where TimeGenerated >= ago(query_frequency))\n    on InstanceUrl, UserId, ClientIp, Message\n| mv-expand Fields\n| summarize\n    UpdatedFields = make_set(Fields.Name, 100),\n    FirstEvent = min(TimeGenerated)\n    by UserId, ClientIp, InstanceUrl, EventCount, EntityName\n| extend Details = bag_pack(\"Entity\", EntityName, \"Count\", EventCount, \"FieldsUpdated\", UpdatedFields)\n| summarize\n    TotalEvents = sum(EventCount),\n    FirstEvent = min(FirstEvent),\n    Details = make_list(Details, 100)\n    by UserId, ClientIp, InstanceUrl\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",
          "T1565"
        ],
        "templateVersion": "3.2.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}