{
  "$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/51c6ba55-fecd-4be0-9064-1aafc4d3e8d6')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/51c6ba55-fecd-4be0-9064-1aafc4d3e8d6')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "An email reported by {{ReporterEmail}} was judged {{Judgement}} by Abnormal Security. Original recipient: {{RecipientEmail}}.",
          "alertDisplayNameFormat": "Abnormal Security: user-reported {{Judgement}} email ({{Subject}})"
        },
        "alertRuleTemplateName": "51c6ba55-fecd-4be0-9064-1aafc4d3e8d6",
        "customDetails": {
          "CampaignId": "CampaignId",
          "Judgement": "Judgement"
        },
        "description": "'Creates an incident when an email a user reported to the Abnormal Security Abuse\nMailbox is judged malicious. Surfaces the reporter, the original recipient, and the\ncampaign so analysts can scope and remediate look-alike messages. Spam- and safe-judged\nreports are intentionally excluded.'\n",
        "displayName": "Abnormal Security - User-reported email judged malicious",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "ReporterEmail",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "MailMessage",
            "fieldMappings": [
              {
                "columnName": "RecipientEmail",
                "identifier": "Recipient"
              },
              {
                "columnName": "Subject",
                "identifier": "Subject"
              },
              {
                "columnName": "MessageId",
                "identifier": "NetworkMessageId"
              }
            ]
          }
        ],
        "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_AbuseMailboxMalicious.yaml",
        "query": "ABNORMAL_SECURITY_ABUSE_MAILBOX_CL\n| where abx_body_abx_body_reported_b == true\n| where tolower(abx_body_abx_body_judgement_s) == \"malicious\"\n| extend\n    ReporterEmail = abx_body_abx_body_reporter_address_s,\n    RecipientEmail = abx_body_abx_body_recipient_address_s,\n    Subject = abx_body_abx_body_subject_s,\n    Judgement = abx_body_abx_body_judgement_s,\n    MessageId = abx_body_abx_body_internet_message_id_s,\n    CampaignId = abx_body_abx_body_campaign_id_g\n| project TimeGenerated, ReporterEmail, RecipientEmail, Subject, Judgement, MessageId, CampaignId\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT5H",
        "suppressionEnabled": false,
        "tactics": [
          "InitialAccess"
        ],
        "techniques": [
          "T1566"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
