{
  "$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/da243bf4-382b-46b9-9b4d-ce6ffe9e7beb')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/da243bf4-382b-46b9-9b4d-ce6ffe9e7beb')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "Abnormal Security opened ATO case {{CaseId}} (severity {{CaseSeverity}}) for the compromised account {{CompromisedAccount}}.",
          "alertDisplayNameFormat": "Abnormal Security: Account Takeover case for {{CompromisedAccount}}"
        },
        "alertRuleTemplateName": "da243bf4-382b-46b9-9b4d-ce6ffe9e7beb",
        "customDetails": {
          "AtoCaseId": "CaseId",
          "CaseSeverity": "CaseSeverity",
          "CaseStatus": "CaseStatus"
        },
        "description": "'Creates an incident when Abnormal Security opens an Account Takeover (ATO) case,\nindicating a mailbox or user account is suspected to be compromised. The ATO case\nseverity, status, and observed indicators are surfaced for triage.'\n",
        "displayName": "Abnormal Security - Account Takeover case opened",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "CompromisedAccount",
                "identifier": "FullName"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "AlertPerResult"
        },
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "lookbackDuration": "PT5H",
            "matchingMethod": "AllEntities",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/AbnormalSecurity/Analytic%20Rules/AbnormalSecurity_AccountTakeover.yaml",
        "query": "ABNORMAL_SECURITY_ATO_CASE_CL\n| where isnotempty(abx_body_abx_body_ato_case_id_s)\n// Collapse to one row per ATO case (earliest event in the window) so repeated\n// events for the same case do not raise duplicate alerts.\n| summarize arg_min(TimeGenerated, *) by CaseId = abx_body_abx_body_ato_case_id_s\n| extend\n    CompromisedAccount = abx_body_abx_body_compromised_account_s,\n    CaseSeverity = abx_body_abx_body_severity_s,\n    CaseStatus = abx_body_abx_body_status_s,\n    Indicators = abx_body_abx_body_indicators_s,\n    FirstDetected = abx_body_abx_body_first_detected_t\n| project TimeGenerated, CompromisedAccount, CaseId, CaseSeverity, CaseStatus, Indicators, FirstDetected\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "High",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT5H",
        "suppressionEnabled": false,
        "tactics": [
          "CredentialAccess",
          "InitialAccess"
        ],
        "techniques": [
          "T1078",
          "T1110"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
