{
  "$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/1747715b-1a94-411a-a2b5-d8c40422767c')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/1747715b-1a94-411a-a2b5-d8c40422767c')]",
      "properties": {
        "alertRuleTemplateName": "1747715b-1a94-411a-a2b5-d8c40422767c",
        "customDetails": null,
        "description": "Cybereinforce blocked a URL/domain access attempt on an enrolled device based on a configured policy pattern (non-threat-intel match).\n",
        "displayName": "CTE - Blocked URL Attempted",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "HostName",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "URL",
            "fieldMappings": [
              {
                "columnName": "Url",
                "identifier": "Url"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "ClientIp",
                "identifier": "Address"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Cybereinforce/Analytic%20Rules/BlockedURLAttempted.yaml",
        "query": "CybereinforceCTE_CL\n| where EventType == \"block.url\"\n| extend d = parse_json(Details)\n| extend\n    DeviceId = tostring(d.deviceId),\n    HostName = iff(isnotempty(tostring(d.hostname)), tostring(d.hostname), strcat(\"cte-device-\", substring(EntityId, 0, 8))),\n    DeviceUser = tostring(d.deviceUser),\n    DeviceOs = tostring(d.deviceOs),\n    DeviceVersion = tostring(d.deviceVersion),\n    RuleId = tostring(d.ruleId),\n    RuleName = iff(isnotempty(tostring(d.ruleName)), tostring(d.ruleName), \"Pattern Match\"),\n    Pattern = tostring(d.pattern),\n    Url = tostring(d.url),\n    Action = tostring(d.action),\n    IsIoc = tobool(d.ioc),\n    ClientIp = tostring(split(tostring(d.clientIp), \":\")[0]),\n    ClientPort = tostring(split(tostring(d.clientIp), \":\")[1]),\n    UserAgent = tostring(d.userAgent)\n| where RuleName != \"Cybereinforce Threat Intelligence\"\n| project TimeGenerated, TenantId, DeviceId, HostName, DeviceUser, DeviceOs, DeviceVersion, RuleId, RuleName, Pattern, Url, Action, IsIoc, ClientIp, ClientPort, UserAgent, Severity, Category, Source\n",
        "queryFrequency": "PT5M",
        "queryPeriod": "PT5M",
        "severity": "Low",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "InitialAccess"
        ],
        "techniques": [
          "T1189"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
