{
  "$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/c32e5873-00b7-45fc-9a7e-43e9d0018978')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/c32e5873-00b7-45fc-9a7e-43e9d0018978')]",
      "properties": {
        "alertRuleTemplateName": "c32e5873-00b7-45fc-9a7e-43e9d0018978",
        "customDetails": null,
        "description": "A Cybereinforce license - paid or trial - is expiring within 7 days. Urgent renewal action is needed to avoid a lapse in protection. Emitted once per license term by the daily tenant health-check job (api/src/functions/tenantHealthChecks.js); re-arms automatically on renewal.\n",
        "displayName": "CTE - License Expiring Critically (7 Days)",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "CloudApplication",
            "fieldMappings": [
              {
                "columnName": "AppName",
                "identifier": "Name"
              },
              {
                "columnName": "TenantId",
                "identifier": "InstanceName"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Cybereinforce/Analytic%20Rules/LicenseExpiringCritically7Days.yaml",
        "query": "CybereinforceCTE_CL\n| where EventType == \"license.expiring_critical\"\n| extend d = parse_json(Details)\n| extend DaysRemaining = toint(d.daysRemaining), EndAt = tostring(d.endAt), Plan = tostring(d.plan), AppName = \"Cybereinforce\"\n| project TimeGenerated, TenantId, DaysRemaining, EndAt, Plan, AppName, Severity, Category, Source\n",
        "queryFrequency": "PT24H",
        "queryPeriod": "P2D",
        "severity": "High",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [],
        "techniques": [],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
