Azure-Sentinel/Playbooks/Sentinel-Incident-Enrich-Ri.../azuredeploy.json

184 строки
9.0 KiB
JSON

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"comments": "Perform automated enrichment on the Azure Sentinel Incidents based on RiskIQ Internet data.",
"author": "Brandon Dixon, RiskIQ"
},
"parameters": {
"PlaybookName": {
"defaultValue": "Sentinel-Incident-Enrich-RiskIQ-Data-Whois-IP",
"type": "string"
},
"UserName": {
"defaultValue": "<username>@<domain>",
"type": "string"
}
},
"variables": {
"AzureSentinelConnectionName": "[concat('azuresentinel-', parameters('PlaybookName'))]",
"RiskIQConnectionName": "[concat('riskiqpassivetotal-', parameters('PlaybookName'))]"
},
"resources": [{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('RiskIQConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/riskiqpassivetotal')]"
}
}
}, {
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('AzureSentinelConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]"
}
}
}, {
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('PlaybookName')]",
"location": "[resourceGroup().location]",
"tags": {
"LogicAppsCategory": "security"
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', variables('RiskIQConnectionName'))]",
"[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]"
],
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Alert_-_Get_incident": {
"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'])}"
},
"runAfter": {},
"type": "ApiConnection"
},
"Entities_-_Get_IPs": {
"inputs": {
"body": "@triggerBody()?['Entities']",
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "post",
"path": "/entities/ip"
},
"runAfter": {
"Alert_-_Get_incident": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"For_each_ip": {
"actions": {
"Add_comment_to_incident_(V3)_2": {
"inputs": {
"body": {
"incidentArmId": "@body('Alert_-_Get_incident')?['id']",
"message": "<p>Associated WHOIS record for @{items('For_each_ip')?['Address']}:<br>\n<br>\nRegistrar: @{body('Get_WHOIS_IP')?['registrar']}<br>\nRegistered:@{body('Get_WHOIS_IP')?['registered']}<br>\nExpires: @{body('Get_WHOIS_IP')?['expiresAt']}<br>\nContact: @{body('Get_WHOIS_IP')?['contactEmail']}<br>\nNameservers: @{body('Get_WHOIS_IP')?['nameServers']}<br>\n<br>\nTo search on WHOIS data or view historic records, see https://community.riskiq.com/search/@{items('For_each_ip')?['Address']}/whois</p>"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "post",
"path": "/Incidents/Comment"
},
"runAfter": {
"Get_WHOIS_IP": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Get_WHOIS_IP": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['riskiqpassivetotal']['connectionId']"
}
},
"method": "get",
"path": "/whois",
"queries": {
"query": "@items('For_each_ip')?['Address']"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "@body('Entities_-_Get_IPs')?['IPs']",
"runAfter": {
"Entities_-_Get_IPs": [
"Succeeded"
]
},
"type": "Foreach"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_response_to_an_Azure_Sentinel_alert_is_triggered": {
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/subscribe"
},
"type": "ApiConnectionWebhook"
}
}
},
"parameters": {
"$connections": {
"value": {
"azuresentinel": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
"connectionName": "[variables('AzureSentinelConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]"
},
"riskiqpassivetotal": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('RiskIQConnectionName'))]",
"connectionName": "[variables('RiskIQConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/riskiqpassivetotal')]"
}
}
}
}
}
}]
}