Azure-Sentinel/Playbooks/Sync-IncidentCommentToM365D.../azuredeploy.json

145 строки
6.6 KiB
JSON

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"title": "Sync - Incident Comment To M365D On Update",
"description": "This playbook will sync incident comments from Microsoft Sentinel to Microsoft 365 Defender when comment is added.",
"prerequisites": "",
"postDeployment": ["1. Add Incident.ReadWrite.All API permission to the playbook's managed identity using PowerShell.", "2. Add playbook as an action to the automation rule - Trigger = When incident is updated; Condition = Incident provider > Equal > Microsoft 365 Defender, and Comments > Added;."
],
"prerequisitesDeployTemplateFile": "",
"lastUpdateTime": "2022-05-30T00:00:00.000Z",
"entities": [
],
"tags": [ "Sync", "Incident Update"
],
"support": {
"tier": "community"
},
"author": {
"name": "Benjamin Kovacevic"
}
},
"parameters": {
"PlaybookName": {
"defaultValue": "Sync-IncidentCommentToM365DOnUpdate",
"type": "string"
}
},
"variables": {
"MicrosoftSentinelConnectionName": "[concat('MicrosoftSentinel-', parameters('PlaybookName'))]"
},
"resources": [
{
"properties": {
"provisioningState": "Succeeded",
"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_incident": {
"type": "ApiConnectionWebhook",
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
}
},
"path": "/incident-creation"
}
}
},
"actions": {
"For_each": {
"foreach": "@triggerBody()?['incidentUpdates']?['comments']",
"actions": {
"HTTP": {
"runAfter": {
},
"type": "Http",
"inputs": {
"authentication": {
"audience": "https://api.security.microsoft.com/",
"type": "ManagedServiceIdentity"
},
"body": {
"comment": "@{items('For_each')?['properties']?['message']}"
},
"headers": {
"Content-Type": "application/json"
},
"method": "PATCH",
"uri": "https://api.security.microsoft.com/api/incidents/@{triggerBody()?['object']?['properties']?['providerIncidentId']}"
}
}
},
"runAfter": {
},
"type": "Foreach"
}
},
"outputs": {
}
},
"parameters": {
"$connections": {
"value": {
"microsoftsentinel": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
"connectionName": "[variables('MicrosoftSentinelConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/Azuresentinel')]",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
}
}
}
}
}
},
"name": "[parameters('PlaybookName')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"identity": {
"type": "SystemAssigned"
},
"tags": {
"hidden-SentinelTemplateName": "Sync-IncidentCommentToM365DOnUpdate",
"hidden-SentinelTemplateVersion": "1.0"
},
"apiVersion": "2017-07-01",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]"
]
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('MicrosoftSentinelConnectionName')]",
"location": "[resourceGroup().location]",
"kind": "V1",
"properties": {
"displayName": "[variables('MicrosoftSentinelConnectionName')]",
"customParameterValues": {
},
"parameterValueType": "Alternative",
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/Azuresentinel')]"
}
}
}
]
}