Add more playbooks and update readme

This commit is contained in:
dicolanl 2019-09-11 16:32:48 -04:00
Родитель 0586e00ec5
Коммит 7657f5716e
5 изменённых файлов: 986 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,294 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata":{
"comments": "This playbook will take each IP entity and query VirusTotal for Ip Address Report (https://developers.virustotal.com/reference#ip-address-report). You will need to register to thier community for an API key.",
"author": "Nicholas DiCola"
},
"parameters": {
"PlaybookName": {
"defaultValue": "Get-IPReputation",
"type": "string"
},
"UserName": {
"defaultValue": "<username>@<domain>",
"type": "string"
},
"LogADisplayName": {
"defaultValue": "<LogADisplayName>",
"type": "string"
},
"VirusTotalAPIKey": {
"defaultValue": "<APIKey>",
"type": "string"
}
},
"variables": {
"AzureLogAnalyticsDataCollectorConnectionName": "[concat('azureloganalyticsdatacollector-', parameters('PlaybookName'))]",
"AzureSentinelConnectionName": "[concat('azuresentinel-', parameters('PlaybookName'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('AzureLogAnalyticsDataCollectorConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('LogADisplayName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azureloganalyticsdatacollector')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('AzureSentinelConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"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]",
"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": {
"When_a_response_to_an_Azure_Sentinel_alert_is_triggered": {
"type": "ApiConnectionWebhook",
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/subscribe"
}
}
},
"actions": {
"Alert_-_Get_IPs": {
"runAfter": {
"Alert_-_Get_incidents": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": "@triggerBody()?['Entities']",
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "post",
"path": "/entities/ip"
}
},
"Alert_-_Get_incidents": {
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "get",
"path": "/cases/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}"
}
},
"For_each": {
"foreach": "@body('Alert_-_Get_IPs')?['IPs']",
"actions": {
"Condition": {
"actions": {
"For_each_2": {
"foreach": "@body('Alert_-_Get_incidents')?['value']",
"actions": {
"Incident_-_Add_comment": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "put",
"path": "/comment/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/@{encodeURIComponent(items('For_each_2')?['name'])}/@{encodeURIComponent(concat('VTIPReport found for ', items('For_each')?['Address'], ' Query VTIPReport_CL | where asn_s == \"', body('Parse_JSON')?['asn'], '\" and country_s == \"', body('Parse_JSON')?['country'],'\"'))}"
}
}
},
"runAfter": {
"Send_Data": [
"Succeeded"
]
},
"type": "Foreach"
},
"Send_Data": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": "@{body('HTTP')}",
"headers": {
"Log-Type": "VTIPReport",
"time-generated-field": "@{utcNow()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azureloganalyticsdatacollector_1']['connectionId']"
}
},
"method": "post",
"path": "/api/logs"
}
}
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"else": {
"actions": {
"For_each_3": {
"foreach": "@body('Alert_-_Get_incidents')?['value']",
"actions": {
"Incident_-_Add_comment_2": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "put",
"path": "/comment/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/@{encodeURIComponent(items('For_each_3')?['name'])}/@{encodeURIComponent('VTIPReport was not found for ',items('For_each')?['Address'])}"
}
}
},
"runAfter": {},
"type": "Foreach"
}
}
},
"expression": {
"and": [
{
"equals": [
"@body('Parse_JSON')?['response_code']",
1
]
}
]
},
"type": "If"
},
"HTTP": {
"runAfter": {},
"type": "Http",
"inputs": {
"method": "GET",
"uri": "https://www.virustotal.com/vtapi/v2/ip-address/report?apikey=@{variables('APIKey')}&ip=@{items('For_each')?['Address']}"
}
},
"Parse_JSON": {
"runAfter": {
"HTTP": [
"Succeeded"
]
},
"type": "ParseJson",
"inputs": {
"content": "@body('HTTP')",
"schema": {
"properties": {
"asn": {
"type": "string"
},
"country": {
"type": "string"
},
"response_code": {
"type": "integer"
},
"verbose_msg": {
"type": "string"
}
},
"type": "object"
}
}
}
},
"runAfter": {
"Alert_-_Get_IPs": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"runAfter": {},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "APIKey",
"type": "String",
"value": "[parameters('VirusTotalAPIKey')]"
}
]
}
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azureloganalyticsdatacollector_1": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('AzureLogAnalyticsDataCollectorConnectionName'))]",
"connectionName": "[variables('AzureSentinelConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azureloganalyticsdatacollector')]"
},
"azuresentinel": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
"connectionName": "[variables('AzureSentinelConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]"
},
}
}
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,316 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata":{
"comments": "This playbook will call the collect invesitgation package in MDATP. It will then loop until thats complete, once complete it will add a comment to the incident and post a message in teams with the URL to download the package.",
"author": "Nicholas DiCola"
},
"parameters": {
"PlaybookName": {
"defaultValue": "Get-MDATPInvestigationPackage",
"type": "string"
},
"UserName": {
"defaultValue": "<username>@<domain>",
"type": "string"
}
},
"variables": {
"AzureSentinelConnectionName": "[concat('azuresentinel-', parameters('PlaybookName'))]",
"MDATPConnectionName": "[concat('wdatp-', parameters('PlaybookName'))]",
"TeamsConnectionName": "[concat('teams-', parameters('PlaybookName'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('AzureSentinelConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('TeamsConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/teams')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('MDATPConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/wdatp')]"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('PlaybookName')]",
"location": "[resourceGroup().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": {
"When_a_response_to_an_Azure_Sentinel_alert_is_triggered": {
"type": "ApiConnectionWebhook",
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/subscribe"
}
}
},
"actions": {
"Alert_-_Get_hosts": {
"runAfter": {
"Alert_-_Get_incidents": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": "@triggerBody()?['Entities']",
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "post",
"path": "/entities/host"
}
},
"Alert_-_Get_incidents": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "get",
"path": "/cases/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}"
}
},
"For_each": {
"foreach": "@body('Alert_-_Get_hosts')?['Hosts']",
"actions": {
"For_each_2": {
"foreach": "@body('Alert_-_Get_incidents')?['value']",
"actions": {
"Actions_-_Collect_investigation_package": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": {
"Comment": "Collect investigation package from playbook for Azure Sentinel Incident: @{items('For_each_2')?['properties']?['Title']}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['wdatp']['connectionId']"
}
},
"method": "post",
"path": "/api/machines/@{encodeURIComponent(items('For_each')?['HostName'])}/collectInvestigationPackage"
}
},
"Actions_-_Get_investigation_package_download_URI": {
"runAfter": {
"Until": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['wdatp']['connectionId']"
}
},
"method": "post",
"path": "/api/machineactions/@{encodeURIComponent(body('Actions_-_Get_single_machine_action')?['id'])}/getPackageUri"
}
},
"Incident_-_Add_comment": {
"runAfter": {
"Actions_-_Get_investigation_package_download_URI": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "put",
"path": "/comment/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/@{encodeURIComponent(items('For_each_2')?['name'])}/@{encodeURIComponent('MDATP Package URL ',body('Actions_-_Get_investigation_package_download_URI')?['value'])}"
}
},
"Post_a_message_(V3)": {
"runAfter": {
"Incident_-_Add_comment": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": {
"body": {
"content": "<p>The investigation package is ready for download at @{body('Actions_-_Get_investigation_package_download_URI')?['value']}</p>",
"contentType": "html"
},
"subject": "MDATP Investgation Package for @{items('For_each_2')?['properties']?['Title']} is Ready"
},
"host": {
"connection": {
"name": "@parameters('$connections')['teams']['connectionId']"
}
},
"method": "post",
"path": "/v3/beta/teams/@{encodeURIComponent('7fdb6cff-0779-45ac-aefd-da589fc62729')}/channels/@{encodeURIComponent('19:2df964c9afc44d60a51bc282f56bacef@thread.skype')}/messages"
}
},
"Set_variable": {
"runAfter": {
"Actions_-_Collect_investigation_package": [
"Succeeded"
]
},
"type": "SetVariable",
"inputs": {
"name": "MachineActionStatus",
"value": "@body('Actions_-_Collect_investigation_package')?['status']"
}
},
"Until": {
"actions": {
"Actions_-_Get_single_machine_action": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['wdatp']['connectionId']"
}
},
"method": "get",
"path": "/api/machineactions/@{encodeURIComponent(body('Actions_-_Collect_investigation_package')?['id'])}"
}
},
"Set_variable_2": {
"runAfter": {
"Actions_-_Get_single_machine_action": [
"Succeeded"
]
},
"type": "SetVariable",
"inputs": {
"name": "MachineActionStatus",
"value": "@body('Actions_-_Get_single_machine_action')?['status']"
}
}
},
"runAfter": {
"Set_variable": [
"Succeeded"
]
},
"expression": "@equals(variables('MachineActionStatus'), 'Succeeded')",
"limit": {
"count": 60,
"timeout": "PT1H"
},
"type": "Until"
}
},
"runAfter": {},
"type": "Foreach"
}
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"runAfter": {
"Alert_-_Get_hosts": [
"Succeeded"
]
},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "MachineActionStatus",
"type": "String",
"value": "null"
}
]
}
}
},
"outputs": {}
},
"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')]"
},
"teams": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]",
"connectionName": "[variables('TeamsConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/teams')]"
},
"wdatp": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('MDATPConnectionName'))]",
"connectionName": "[variables('MDATPConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/wdatp')]"
}
}
}
}
}
}
]
}

Просмотреть файл

@ -9,12 +9,14 @@ After selecting a playbook, in the Azure Sentinel portal:
4. Click Save
5. Fill in needed data and click purchase
Once deployment is complete, you will need to authorize the connection.
Once deployment is complete, you will need to authorize each connection.
1. Click the Azure Sentinel connection resource
2. Click edit API connection
3. Click Authorize
4. Sign in
5. Click Save
6. Repeat steps for other connections
a. For Azure Log Analytics Data Collector, you will need to add the workspace ID and Key
You can now edit the playbook in Logic apps.

Просмотреть файл

@ -0,0 +1,186 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata":{
"comments": "This playbook will restrict app execution on the machine in Microsoft Defender ATP",
"author": "Nicholas DiCola"
},
"parameters": {
"PlaybookName": {
"defaultValue": "Restrict-MDATPAppExecution",
"type": "string"
},
"UserName": {
"defaultValue": "<username>@<domain>",
"type": "string"
}
},
"variables": {
"AzureSentinelConnectionName": "[concat('azuresentinel-', parameters('PlaybookName'))]",
"MDATPConnectionName": "[concat('wdatp-', parameters('PlaybookName'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('AzureSentinelConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('MDATPConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/wdatp')]"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('PlaybookName')]",
"location": "[resourceGroup().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": {
"When_a_response_to_an_Azure_Sentinel_alert_is_triggered": {
"type": "ApiConnectionWebhook",
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/subscribe"
}
}
},
"actions": {
"Alert_-_Get_hosts": {
"runAfter": {
"Alert_-_Get_incidents": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": "@triggerBody()?['Entities']",
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "post",
"path": "/entities/host"
}
},
"Alert_-_Get_incidents": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "get",
"path": "/cases/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}"
}
},
"For_each": {
"foreach": "@body('Alert_-_Get_hosts')?['Hosts']",
"actions": {
"For_each_2": {
"foreach": "@body('Alert_-_Get_incidents')?['value']",
"actions": {
"Actions_-_Restrict_app_execution": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": {
"Comment": "Isolated from playbook for Azure Sentinel Incident: @{items('For_each_2')?['properties']?['Title']}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['wdatp']['connectionId']"
}
},
"method": "post",
"path": "/api/machines/@{encodeURIComponent(items('For_each')?['HostName'])}/restrictCodeExecution"
}
},
"Incident_-_Add_comment": {
"runAfter": {
"Actions_-_Restrict_app_execution": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "put",
"path": "/comment/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/@{encodeURIComponent(items('For_each_2')?['name'])}/@{encodeURIComponent('Machine (',items('For_each')?['HostName'],') was restricted for app exection in MDATP. The status was ',body('Actions_-_Restrict_app_execution')?['status'],'.')}"
}
}
},
"runAfter": {},
"type": "Foreach"
}
},
"runAfter": {
"Alert_-_Get_hosts": [
"Succeeded"
]
},
"type": "Foreach"
}
},
"outputs": {}
},
"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')]"
},
"wdatp": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('MDATPConnectionName'))]",
"connectionName": "[variables('MDATPConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/wdatp')]"
}
}
}
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,187 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata":{
"comments": "This playbook will run a antivirus (full) scan on the machine in Microsoft Defender ATP",
"author": "Nicholas DiCola"
},
"parameters": {
"PlaybookName": {
"defaultValue": "Run-MDATPAntivirus",
"type": "string"
},
"UserName": {
"defaultValue": "<username>@<domain>",
"type": "string"
}
},
"variables": {
"AzureSentinelConnectionName": "[concat('azuresentinel-', parameters('PlaybookName'))]",
"MDATPConnectionName": "[concat('wdatp-', parameters('PlaybookName'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('AzureSentinelConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('MDATPConnectionName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('UserName')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/wdatp')]"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('PlaybookName')]",
"location": "[resourceGroup().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": {
"When_a_response_to_an_Azure_Sentinel_alert_is_triggered": {
"type": "ApiConnectionWebhook",
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/subscribe"
}
}
},
"actions": {
"Alert_-_Get_hosts": {
"runAfter": {
"Alert_-_Get_incidents": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": "@triggerBody()?['Entities']",
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "post",
"path": "/entities/host"
}
},
"Alert_-_Get_incidents": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "get",
"path": "/cases/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}"
}
},
"For_each": {
"foreach": "@body('Alert_-_Get_hosts')?['Hosts']",
"actions": {
"For_each_2": {
"foreach": "@body('Alert_-_Get_incidents')?['value']",
"actions": {
"Actions_-_Run_antivirus_scan": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": {
"Comment": "AV run from playbook for Azure Sentinel Incident: @{items('For_each_2')?['properties']?['Title']}",
"ScanType": "Full"
},
"host": {
"connection": {
"name": "@parameters('$connections')['wdatp']['connectionId']"
}
},
"method": "post",
"path": "/api/machines/@{encodeURIComponent(items('For_each')?['HostName'])}/runAntiVirusScan"
}
},
"Incident_-_Add_comment": {
"runAfter": {
"Actions_-_Run_antivirus_scan": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"method": "put",
"path": "/comment/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/@{encodeURIComponent(items('For_each_2')?['name'])}/@{encodeURIComponent('Machine (',items('For_each')?['HostName'],') had full AV scann triggered in MDATP. The status was ',body('Actions_-_Run_antivirus_scan')?['status'],'.')}"
}
}
},
"runAfter": {},
"type": "Foreach"
}
},
"runAfter": {
"Alert_-_Get_hosts": [
"Succeeded"
]
},
"type": "Foreach"
}
},
"outputs": {}
},
"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')]"
},
"wdatp": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('MDATPConnectionName'))]",
"connectionName": "[variables('MDATPConnectionName')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/wdatp')]"
}
}
}
}
}
}
]
}