{
    "name": "SonraiSecurityPush",
    "apiVersion": "2022-09-01-preview",
    "type": "Microsoft.SecurityInsights/dataConnectorDefinitions",
    "location": "{{location}}",
    "kind": "Customizable",
    "properties": {
        "connectorUiConfig": {
            "id": "SonraiSecurityPush",
            "title": "Sonrai Security Push Connector",
            "publisher": "Sonrai",
            "descriptionMarkdown": "The [Sonrai Security](https://sonraisecurity.com) connector provides the capability to ingest Sonrai ticket data into Microsoft Sentinel. Use this data connector to integrate with Sonrai Security and get Sonrai tickets sent directly to Microsoft Sentinel for threat detection and investigation.",
            "graphQueries": [
                {
                    "metricName": "Sonrai Tickets",
                    "legend": "SonraiSecurityTickets_CL",
                    "baseQuery": "SonraiSecurityTickets_CL"
                }
            ],
            "sampleQueries": [
                {
                    "description": "Sonrai Security - All Tickets",
                    "query": "SonraiSecurityTickets_CL\n | sort by TimeGenerated desc"
                },
                {
                    "description": "Sonrai Security - Tickets by Resource Type",
                    "query": "SonraiSecurityTickets_CL\n | summarize count() by digest_resourceType"
                }
            ],
            "dataTypes": [
                {
                    "name": "SonraiSecurityTickets_CL",
                    "lastDataReceivedQuery": "SonraiSecurityTickets_CL\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
                }
            ],
            "connectivityCriteria": [
                {
                    "type": "IsConnectedQuery",
                    "value": [
                        "SonraiSecurityTickets_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 Sonrai Security uses in a Microsoft Analytics Workspace. When [data forwarding](https://sonraisecurity.com/docs) is enabled in Sonrai Security, raw ticket 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": "Sonrai Security connector resources",
                                "applicationDisplayName": "Sonrai Security Connector Application"
                            },
                            "type": "DeployPushConnectorButton"
                        }
                    ]
                },
                {
                    "title": "2. Push your logs into the workspace",
                    "description": "Use the following parameters to configure Sonrai Security 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": "Tickets Stream Name",
                                "value": "Custom-SonraiSecurityTickets"
                            },
                            "type": "CopyableLabel"
                        }
                    ]
                },
                {
                    "title": "3. Configure Sonrai Security",
                    "description": "Configure the Sonrai Security platform with the Azure connection details to enable data forwarding to Microsoft Sentinel.",
                    "instructions": [
                        {
                            "type": "Markdown",
                            "parameters": {
                                "content": "#### Configure Microsoft Sentinel Integration in Sonrai Security\n\n1. Navigate to the Sonrai Security dashboard.\n2. On the bottom left panel, click on **Integrations**.\n3. Select **Microsoft Sentinel** from the list of available integrations.\n4. Fill in the form using the information provided in Step 2 above:\n   - **Tenant ID**\n   - **Application (client) ID**\n   - **Client Secret Value**\n   - **Data Collection Endpoint URL**\n   - **DCR Immutable ID**\n   - **Stream Name**"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
