{
  "$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/6b052c8d-5de8-eab0-1956-69a297765a32')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/6b052c8d-5de8-eab0-1956-69a297765a32')]",
      "properties": {
        "alertRuleTemplateName": "6b052c8d-5de8-eab0-1956-69a297765a32",
        "customDetails": null,
        "description": "Identifies when a new Tailscale auth key is generated. Auth keys allow unattended device enrollment into the tailnet - confirm it was expected and revoke if not.\n",
        "displayName": "Tailscale: Auth key created",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "ActorLogin",
                "identifier": "FullName"
              }
            ]
          }
        ],
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "lookbackDuration": "PT5H",
            "matchingMethod": "AllEntities",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Tailscale%20%28CCF%29/Analytic%20Rules/TailscaleAuthkeycreated.yaml",
        "query": "Tailscale_Audit_CL\n      | where Action == \"CREATE\"\n      | where tostring(Target.type) == \"AUTH_KEY\"\n      | extend ActorLogin = tostring(Actor.loginName)\n      | extend KeyDescription = tostring(New.description)\n      | extend Reusable = tostring(New.reusable)\n      | extend Ephemeral = tostring(New.ephemeral)\n      | project TimeGenerated, ActorLogin, KeyDescription, Reusable, Ephemeral, Origin, New\n",
        "queryFrequency": "PT15M",
        "queryPeriod": "PT15M",
        "severity": "Low",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Persistence"
        ],
        "techniques": [
          "T1098"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
