{
  "$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/3b4df6eb-ad70-4896-a82d-07d27b22f6e8')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/3b4df6eb-ad70-4896-a82d-07d27b22f6e8')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "No CSE events ingested for more than the threshold. Last ingestion: {{LastIngested}}.",
          "alertDisplayNameFormat": "SonicWall CSE: no events ingested since {{LastIngested}}"
        },
        "alertRuleTemplateName": "3b4df6eb-ad70-4896-a82d-07d27b22f6e8",
        "customDetails": {
          "HoursSinceLast": "HoursSinceLastIngestion",
          "LastIngested": "LastIngested"
        },
        "description": "'No SonicWall Cloud Secure Edge (CSE) events have been ingested for longer than the\nthreshold. It complements the health rule: it does not depend on health monitoring being\nenabled, and it also fires when the connector is disconnected or ingestion stops for a reason\nthe connector does not report (for example the workspace daily cap).\nPossible causes: the connector stopped polling or was disconnected, the API key is invalid,\nthe workspace daily cap was reached, or CSE produced no events. Check the connector, then\ncompare with the CSE events API before assuming data was lost.\nSet QuietThreshold to the longest normal quiet period for the organization; a short threshold\nalso fires during quiet periods, such as nights or weekends with no CSE activity. Outages\nshorter than the threshold are reported by the connector health rule.'\n",
        "displayName": "SonicWall CSE - No events ingested",
        "enabled": true,
        "entityMappings": null,
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/SonicWall%20Cloud%20Secure%20Edge/Analytic%20Rules/SonicWallCSENoEventsIngested.yaml",
        "query": "let QuietThreshold = 2h;\n// One row is always returned; LastIngested is null when nothing arrived within the query period.\nCSEEvents_CL\n| summarize LastIngested = max(ingestion_time()), LastEventTime = max(TimeGenerated)\n| where isnull(LastIngested) or LastIngested < ago(QuietThreshold)\n| extend HoursSinceLastIngestion = iff(isnull(LastIngested), real(null), round((now() - LastIngested) / 1h, 1))\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "P1D",
        "severity": "Medium",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "DefenseEvasion"
        ],
        "techniques": [
          "T1562"
        ],
        "templateVersion": "1.0.1",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
