{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "workspace": {
            "type": "string",
            "defaultValue": ""
        }
    },
    "resources": [
        {
            "id": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.OperationalInsights/workspaces/',parameters('workspace'),'/providers/Microsoft.SecurityInsights/dataConnectors/',guid(resourceGroup().id, deployment().name))]",
            "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',guid(resourceGroup().id, deployment().name))]",
            "apiVersion": "2021-03-01-preview",
            "type": "Microsoft.OperationalInsights/workspaces/providers/dataConnectors",
            "kind": "APIPolling",
            "properties": {
                "connectorUiConfig": {
                    "title": "Enter name of data connector",
                    "publisher": "Enter publisher company name",
                    "descriptionMarkdown": "Describe what logs are coming in and link to the product etc. for more info on the data connector",
                    "graphQueriesTableName": "{DataTypeName}_CL",
                    "graphQueries": [{
                            "metricName": "Total data received",
                            "legend": "DATATYPE_NAME",
                            "baseQuery": "{{graphQueriesTableName}}"
                        }
                    ],
                    "sampleQueries": [{
                            "description": "One-line title for your sample query 1",
                            "query": "Kusto Query 1"
                        }
                    ],
                    "dataTypes": [{
                            "name": "{{graphQueriesTableName}}",
                            "lastDataReceivedQuery": "{{graphQueriesTableName}}\n            | summarize Time = max(TimeGenerated)\n            | where isnotempty(Time)"
                        }
                    ],
                    "connectivityCriterias": [{
                            "type": "SentinelKindsV2",
                            "value": [
                                "APIPolling"
                            ]
                        }
                    ],
                    "availability": {
                        "status": 1,
                        "isPreview": true
                    },
                    "permissions": {
                        "resourceProvider": [{
                                "provider": "Microsoft.OperationalInsights/workspaces",
                                "permissionsDisplayText": "read and write permissions are required.",
                                "providerDisplayName": "Workspace",
                                "scope": "Workspace",
                                "requiredPermissions": {
                                    "action": true,
                                    "write": true,
                                    "read": true,
                                    "delete": true
                                }
                            }
                        ],
                        "customs": [ {
                                "name": "Include custom pre-requisites if the connectivity requires like API key etc. info - else delete customs",
                                "description": "Description for any custom pre-requisite with link to docuemntation on how to get this pre-requisite fulfilled."
                            }
                        ]
                    },
                    "instructionSteps": [
                        {
                            "title": "1. How to get access to the data connector\n 2. If you have documentation to connect on your side link to that\n 3. Else, provide step by step instructions to discover the connection in your product\n",
                            "description": "Configuration parameter 1 title",
                            "instructions": [
                                {
                                    "parameters": {
                                        "enable": "true"
                                    },
                                    "type": "Input type for e.g. APIKey"
                                }
                            ]
                        }
                    ]
                },
                "pollingConfig": 
                    {
                        "owner": "ASI",
                        "version": "2.0",
                        "source": "PaaS",
                        "auth": {
                            "authType": "APIKey",
                            "APIKeyName": "provhash",
                            "IsAPIKeyInPostPayload": true
                        },
                        "request": {
                            "apiEndpoint": "endpoint URL of the API - update all parameters below as needed including paging type based on the API. This is an example only. For info on properties refer to https://docs.microsoft.com/azure/sentinel/create-codeless-connector?tabs=deploy-via-arm-template%2Cconnect-via-the-azure-portal",
                            "rateLimitQPS": 2,
                            "httpMethod": "Post",
                            "queryTimeFormat": "yyyy-MM-ddTHH:mm:ssZ",
                            "retryCount": 3,
                            "queryWindowInMin": 10,
                            "timeoutInSeconds": 120,
                            "queryParametersTemplate": "{'cid': '12537091', 'cmd': 'reporting', 'data': { 'from': '{_QueryWindowStartTime}', 'to': '{_QueryWindowEndTime}' }, '{_APIKeyName}': '{_APIKey}'}",
                            "isPostPayloadJson": true
                        },
                        "response": {
                            "eventsJsonPaths": [
                                "$.data"
                            ],
                            "successStatusJsonPath": "$.status",
                            "successStatusValue": "OK",
                            "convertChildPropertiesToArray": true
                        },
                        "paging": {
                            "pagingType": "NextPageToken",
                            "nextPageParaName": "next",
                            "nextPageTokenJsonPath": "$.next"
                        }
                    }
            }
            }
    ]
}
