{
  "$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/32e7bcab-4424-516e-9c7c-dbe868144494')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/32e7bcab-4424-516e-9c7c-dbe868144494')]",
      "properties": {
        "alertRuleTemplateName": "32e7bcab-4424-516e-9c7c-dbe868144494",
        "customDetails": {
          "ASN": "ASN",
          "AsnName": "AsnName",
          "NewScore": "NewScore",
          "OldScore": "OldScore",
          "ScoreDelta": "ScoreDelta"
        },
        "description": "Detects autonomous systems whose reputation score has increased by more than 20 points in the last 24 hours. Higher scores indicate worse reputation, so a score increase signals degradation that may indicate adversary use of the network.\n",
        "displayName": "Whisper Security - ASN Reputation Degradation",
        "enabled": true,
        "entityMappings": null,
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "lookbackDuration": "PT5H",
            "matchingMethod": "AllEntities",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Whisper/Analytic%20Rules/AsnReputationDegradation.yaml",
        "query": "// MITRE ATT&CK: T1583.002 - Acquire Infrastructure: DNS Server\n// Tactic: Resource Development\n// Detects ASN reputation degradation (score increase > 20 points in 24h)\n// Note: Higher reputationScore = worse reputation\nlet degradationThreshold = 20;\nlet currentScores = WhisperASNReputation_CL\n    | where TimeGenerated > ago(1h)\n    | summarize (LatestTime, CurrentScore, CurrentLevel, AsnName, Country, PrefixCount, PeerCount) = arg_max(TimeGenerated, reputationScore, reputationLevel, asnName, country, prefixCount, peerCount) by asn\n    | project asn, CurrentScore, CurrentLevel, AsnName, Country, PrefixCount, PeerCount;\nlet previousScores = WhisperASNReputation_CL\n    | where TimeGenerated between (ago(1d) .. ago(1h))\n    | summarize (PreviousTime, PreviousScore) = arg_max(TimeGenerated, reputationScore) by asn\n    | project asn, PreviousScore;\ncurrentScores\n    | join kind=inner (previousScores) on asn\n    | extend ScoreDelta = CurrentScore - PreviousScore\n    | where ScoreDelta > degradationThreshold\n    | project TimeGenerated = now(), ASN = asn, AsnName, OldScore = PreviousScore, NewScore = CurrentScore, ScoreDelta, CurrentLevel, Country, PrefixCount, PeerCount\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "P1D",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "ResourceDevelopment"
        ],
        "techniques": [
          "T1583"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
