{
  "$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/7f4af730-5c89-4f7a-aa7a-933b6e9309b5')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/7f4af730-5c89-4f7a-aa7a-933b6e9309b5')]",
      "properties": {
        "alertRuleTemplateName": "7f4af730-5c89-4f7a-aa7a-933b6e9309b5",
        "customDetails": null,
        "description": "Device license capacity has reached 99% - new and existing unmanaged devices may go unprotected. Emitted once when usage newly crosses this threshold by the daily tenant health-check job (api/src/functions/tenantHealthChecks.js); resets and can re-fire if usage later drops back below 95% and crosses again.\n",
        "displayName": "CTE - Device License Capacity Critical (99%)",
        "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/DeviceLicenseCapacityCritical99.yaml",
        "query": "CybereinforceCTE_CL\n| where EventType == \"license.capacity_critical\"\n| extend d = parse_json(Details)\n| extend AppName = \"Cybereinforce\", ActiveDevices = toint(d.activeDevices), LicensedDevices = toint(d.licensedDevices), UsedPct = todouble(d.usedPct)\n| project TimeGenerated, TenantId, AppName, ActiveDevices, LicensedDevices, UsedPct, 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"
    }
  ]
}
