Skip to content

Commit

Permalink
Initial Push of Salem Integration
Browse files Browse the repository at this point in the history
- playbook to collect Sentinel alerts and forward them to Salem
- workbook to view Salem analysis in log analytics
  • Loading branch information
jonbagg committed Apr 3, 2023
1 parent 98d4b6f commit 91d5399
Show file tree
Hide file tree
Showing 2 changed files with 534 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"PlaybookName": {
"type": "string",
"metadata": {
"description": "A Globally unique name for the integration logic app"
}
},
"SalemEventHubConnectionString": {
"type": "securestring",
"metadata": {
"description": "The Connection String from the Salem 'alerts' Event Hub"
}
},
"location": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Location for all resources. Leave blank to use location of resource group"
}
}
},
"variables": {
"location": "[if(empty(parameters('location')), resourceGroup().location, parameters('location'))]",
"SalemEventHubConnectionName": "[concat('SalemEventHub-', parameters('PlaybookName'))]",
"SentinelConnectionName": "[concat('MicrosoftSentinel-', parameters('PlaybookName'))]"
},
"resources": [
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('PlaybookName')]",
"location": "[variables('location')]",
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Microsoft_Sentinel_alert": {
"type": "ApiConnectionWebhook",
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/subscribe"
}
}
},
"actions": {
"Alert_-_Get_incident": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "get",
"path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
}
},
"Initialize_variable_alert_body": {
"runAfter": {
"Alert_-_Get_incident": [
"Succeeded"
]
},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "alert_body",
"type": "object",
"value": {
"custom_details": "@json(coalesce(triggerBody()?['ExtendedProperties']?['Custom Details'],'{}'))",
"earliest": "@triggerBody()['ExtendedProperties']['Query Start Time UTC']",
"entities": "@triggerBody()?['Entities']",
"incident_id": "@body('Alert_-_Get_incident')?['properties']?['incidentNumber']",
"latest": "@triggerBody()['ExtendedProperties']['Query End Time UTC']"
}
}
]
}
},
"Initialize_variable_alert": {
"runAfter": {
"Initialize_variable_alert_body": [
"Succeeded"
]
},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "alert_formatted",
"type": "object",
"value": {
"alert": "@variables('alert_body')",
"alert_name": "@triggerBody()?['AlertDisplayName']",
"id": "@triggerBody()?['SystemAlertId']",
"source": "sentinel"
}
}
]
}
},
"Send_event": {
"runAfter": {
"Initialize_variable_alert": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": {
"ContentData": "@{base64(variables('alert_formatted'))}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['eventhubs']['connectionId']"
}
},
"method": "post",
"path": "/@{encodeURIComponent('alerts')}/events"
}
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azuresentinel": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('SentinelConnectionName'))]",
"connectionName": "[variables('SentinelConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('location'), '/managedApis/azuresentinel')]"
},
"eventhubs": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('SalemEventHubConnectionname'))]",
"connectionName": "[variables('SalemEventHubConnectionname')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('location'), '/managedApis/eventhubs')]"
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', variables('SentinelConnectionName'))]",
"[resourceId('Microsoft.Web/connections', variables('SalemEventHubConnectionname'))]"
]
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('SalemEventHubConnectionname')]",
"location": "[variables('location')]",
"kind": "V1",
"properties": {
"displayName": "Salem Event Hubs",
"api": {
"name": "[variables('SalemEventHubConnectionname')]",
"displayName": "Salem Event Hubs",
"description": "Connect to The Salem Event Hub to send alerts.",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('location'), '/managedApis/eventhubs')]",
"type": "Microsoft.Web/locations/managedApis"
},
"parameterValues": {
"connectionString": "[parameters('SalemEventHubConnectionString')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('SentinelConnectionName')]",
"location": "[variables('location')]",
"kind": "V1",
"properties": {
"displayName": "Microsoft Sentinel",
"api": {
"name": "[variables('SentinelConnectionName')]",
"displayName": "Microsoft Sentinel",
"description": "Cloud-native SIEM with a built-in AI so you can focus on what matters most",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('location'), '/managedApis/azuresentinel')]",
"type": "Microsoft.Web/locations/managedApis"
}
}
}
]
}
Loading

0 comments on commit 91d5399

Please sign in to comment.