{
    "name": "DarktraceActiveAISecurityPlatform",
    "apiVersion": "2022-09-01-preview",
    "type": "Microsoft.SecurityInsights/dataConnectorDefinitions",
    "location": "[parameters('workspace-location')]",
    "kind": "Customizable",
    "properties": {
      "connectorUiConfig": {
        "id": "DarktraceActiveAISecurityPlatform",
        "title": "Darktrace ActiveAI Security Platform Connector",
        "publisher": "Darktrace",
        "descriptionMarkdown": "The Darktrace ActiveAI Security Platform Connector connector provides the capability to read raw event data from Darktrace in Microsoft Sentinel.",
        "graphQueries": [
          {
            "metricName": "Attack Surface Management",
            "legend": "DarktraceASM_CL",
            "baseQuery": "DarktraceASM_CL"
          },
          {
            "metricName": "EMAIL",
            "legend": "DarktraceEMAIL_CL",
            "baseQuery": "DarktraceEMAIL_CL"
          },
          {
            "metricName": "AI Analyst Incidents",
            "legend": "DarktraceIncidents_CL",
            "baseQuery": "DarktraceIncidents_CL"
          },
          {
            "metricName": "Model Alerts",
            "legend": "DarktraceModelAlerts_CL",
            "baseQuery": "DarktraceModelAlerts_CL"
          },
          {
            "metricName": "Autonomous Response",
            "legend": "DarktraceResponseActions_CL",
            "baseQuery": "DarktraceResponseActions_CL"
          },
          {
            "metricName": "System Status Alerts",
            "legend": "DarktraceSystemStatusAlerts_CL",
            "baseQuery": "DarktraceSystemStatusAlerts_CL"
          }
        ],
        "sampleQueries": [
          {
            "description": "Darktrace - All Model Alerts",
            "query": "DarktraceModelAlerts_CL\n | sort by TimeGenerated desc"
          },
          {
            "description": "Darktrace - All AI Analyst Incidents",
            "query": "DarktraceIncidents_CL\n | sort by TimeGenerated desc"
          }
        ],
        "dataTypes": [
          {
            "name": "DarktraceASM_CL",
            "lastDataReceivedQuery": "DarktraceASM_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
          },
          {
            "name": "DarktraceEMAIL_CL",
            "lastDataReceivedQuery": "DarktraceEMAIL_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
          },
          {
            "name": "DarktraceIncidents_CL",
            "lastDataReceivedQuery": "DarktraceIncidents_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
          },
          {
            "name": "DarktraceModelAlerts_CL",
            "lastDataReceivedQuery": "DarktraceModelAlerts_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
          },
          {
            "name": "DarktraceResponseActions_CL",
            "lastDataReceivedQuery": "DarktraceResponseActions_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
          },
          {
            "name": "DarktraceSystemStatusAlerts_CL",
            "lastDataReceivedQuery": "DarktraceSystemStatusAlerts_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
          }
        ],
        "connectivityCriteria": [
          {
            "type": "IsConnectedQuery",
            "value": [
              "DarktraceASM_CL\n            | summarize LastLogReceived = max(TimeGenerated)\n            | project IsConnected = LastLogReceived > ago(7d)",
              "DarktraceEMAIL_CL\n            | summarize LastLogReceived = max(TimeGenerated)\n            | project IsConnected = LastLogReceived > ago(7d)",
              "DarktraceIncidents_CL\n            | summarize LastLogReceived = max(TimeGenerated)\n            | project IsConnected = LastLogReceived > ago(7d)",
              "DarktraceModelAlerts_CL\n            | summarize LastLogReceived = max(TimeGenerated)\n            | project IsConnected = LastLogReceived > ago(7d)",
              "DarktraceResponseActions_CL\n            | summarize LastLogReceived = max(TimeGenerated)\n            | project IsConnected = LastLogReceived > ago(7d)",
              "DarktraceSystemStatusAlerts_CL\n            | summarize LastLogReceived = max(TimeGenerated)\n            | project IsConnected = LastLogReceived > ago(7d)"
            ]
          }
        ],
        "availability": {
          "status": 1
        },
        "permissions": {
          "resourceProvider": [
            {
              "provider": "Microsoft.OperationalInsights/workspaces",
              "permissionsDisplayText": "read and write permissions are required.",
              "providerDisplayName": "Workspace",
              "scope": "Workspace",
              "requiredPermissions": {
                "write": true,
                "read": true,
                "delete": true
              }
            }
          ],
          "customs": [
            {
              "name": "Microsoft Entra",
              "description": "Permission to create an app registration in Microsoft Entra ID. Typically requires Entra ID Application Developer role or higher."
            },
            {
              "name": "Microsoft Azure",
              "description": "Permission to assign Monitoring Metrics Publisher role on data collection rule (DCR). Typically requires Azure RBAC Owner or User Access Administrator role"
            }
          ]
        },
        "instructionSteps": [
          {
            "title": "1. Create ARM Resources and Provide the Required Permissions",
            "description": "This connector reads data from the tables that Darktrace uses in a Microsoft Analytics Workspace, if the Microsoft Sentinel Log Ingestion configuration is enabled in Darktrace then raw event data is sent to the Microsoft Sentinel Ingestion API.",
            "instructions": [
              {
                "type": "Markdown",
                "parameters": {
                  "content": "#### Automated Configuration and Secure Data Ingestion with Entra Application \nClicking on \"Deploy\" will trigger the creation of Log Analytics tables and a Data Collection Rule (DCR). \nIt will then create an Entra application, link the DCR to it, and set the entered secret in the application. This setup enables data to be sent securely to the DCR using an Entra token."
                }
              },
              {
                "parameters": {
                  "label": "Deploy Darktrace connector resources",
                  "applicationDisplayName": "Darktrace Connector Application"
                },
                "type": "DeployPushConnectorButton"
              }
            ]
          },
          {
            "title": "2. Push your logs into the workspace",
            "description": "Use the following parameters to configure the your machine to send the logs to the workspace.",
            "instructions": [
              {
                "parameters": {
                  "label": "Tenant ID (Directory ID)",
                  "fillWith": [
                    "TenantId"
                  ]
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Entra App Registration Application ID",
                  "fillWith": [
                    "ApplicationId"
                  ],
                  "placeholder": "Deploy push connector to get the App Registration Application ID"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Entra App Registration Secret",
                  "fillWith": [
                    "ApplicationSecret"
                  ],
                  "placeholder": "Deploy push connector to get the App Registration Secret"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Data Collection Endpoint Uri",
                  "fillWith": [
                    "DataCollectionEndpoint"
                  ],
                  "placeholder": "Deploy push connector to get the Data Collection Endpoint Uri"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Data Collection Rule Immutable ID",
                  "fillWith": [
                    "DataCollectionRuleId"
                  ],
                  "placeholder": "Deploy push connector to get the Data Collection Rule Immutable ID"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Attack Surface Management Stream Name",
                  "value": "Custom-DarktraceASM"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "EMAIL Stream Name",
                  "value": "Custom-DarktraceEMAIL"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "AI Analyst Incidents Stream Name",
                  "value": "Custom-DarktraceIncidents"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Model Alerts Stream Name",
                  "value": "Custom-DarktraceModelAlerts"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "Autonomous Response Stream Name",
                  "value": "Custom-DarktraceResponseActions"
                },
                "type": "CopyableLabel"
              },
              {
                "parameters": {
                  "label": "System Status Alerts Stream Name",
                  "value": "Custom-DarktraceSystemStatusAlerts"
                },
                "type": "CopyableLabel"
              }
            ]
          }
        ]
      }
    }
  }