{
  "$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/969e2e5c-9cc6-423c-a3de-514f7ad75fe7')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/969e2e5c-9cc6-423c-a3de-514f7ad75fe7')]",
      "properties": {
        "alertRuleTemplateName": "969e2e5c-9cc6-423c-a3de-514f7ad75fe7",
        "customDetails": null,
        "description": "This will alert when a successful vault export has occurred within 14 days of a new account being created within 1Password.\n\nRef: https://1password.com/\nRef: https://github.com/securehats/",
        "displayName": "1Password - Vault export post account creation",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "TargetUsername",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "SrcIpAddr",
                "identifier": "Address"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "SingleAlert"
        },
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "lookbackDuration": "PT1H",
            "matchingMethod": "AllEntities",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/1Password/Analytics%20Rules/1Password%20-%20Vault%20Export%20Post%20Account%20Creation.yaml",
        "query": "let ruleFrequency = 1h;\nlet lookback = 14d;\nlet onePasswordUserCreationCheck =\n    OnePasswordEventLogs_CL\n    | where TimeGenerated between (ago(lookback) .. ago(now() - ago(ruleFrequency)))\n    | extend creationActivityFound = iff(action == \"activate\" and object_type == \"user\", bool(1), bool(0))\n;\nOnePasswordEventLogs_CL\n| where action == \"export\" and object_type == \"vault\"\n| extend userUuid = tostring(actor_details.uuid)\n| join (\n    onePasswordUserCreationCheck\n    | where creationActivityFound == true\n    | extend userUuid = tostring(object_details.uuid)\n    )\n    on $left.userUuid == $right.userUuid\n| extend\n    TargetUsername = object_details1.email\n    , SrcIpAddr = session1.ip_address",
        "queryFrequency": "PT1H",
        "queryPeriod": "P14D",
        "severity": "Medium",
        "subTechniques": [],
        "suppressionDuration": "PT5H",
        "suppressionEnabled": false,
        "tactics": [
          "CredentialAccess",
          "Persistence"
        ],
        "techniques": [
          "T1136",
          "T1555"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
