Azure-Sentinel/Playbooks/Edgescan-AzureSentinel-Inte.../azuredeploy3.json

206 строки
9.5 KiB
JSON

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"comments": "This playbook will run every day and ingest host records created in Edgescan in the last two days. If these records are not in the Azure Sentinel edgescan_hosts custom log, they will be added.",
"author": "Arbala Security"
},
"parameters": {
"PlaybookName": {
"defaultValue": "edgescan_hosts",
"type": "string"
},
"EdgescanURL": {
"defaultValue": "example.edgescan.com",
"type": "string"
},
"EdgescanUsername": {
"defaultValue": "Edgescan username",
"type": "string"
},
"EdgescanPassword": {
"defaultValue": "Edgescan password",
"type": "string"
}
},
"variables": {
"azureloganalyticsdatacollector": "[concat('azureloganalyticsdatacollector-', parameters('PlaybookName'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[variables('azureloganalyticsdatacollector')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('PlaybookName')]",
"customParameterValues": {
},
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azureloganalyticsdatacollector')]"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('PlaybookName')]",
"location": "[resourceGroup().location]",
"tags": {
"LogicAppsCategory": "security"
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', variables('azureloganalyticsdatacollector'))]"
],
"properties": {
"state": "Disabled",
"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": {
"Polling_Frequency": {
"recurrence": {
"frequency": "Hour",
"interval": 24
},
"type": "Recurrence"
}
},
"actions": {
"For_Each_Host": {
"foreach": "@body('Parse_JSON')?['hosts']",
"actions": {
"Send_Data": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": "@{items('For_Each_Host')}",
"headers": {
"Log-Type": "[parameters('PlaybookName')]"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azureloganalyticsdatacollector']['connectionId']"
}
},
"method": "post",
"path": "/api/logs"
}
}
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_Ingested_Hosts_Variable": {
"runAfter": {},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "Ingested Hosts",
"type": "string"
}
]
}
},
"Parse_JSON": {
"runAfter": {
"Send_HTTP_GET_Hosts_Request": [
"Succeeded"
]
},
"type": "ParseJson",
"inputs": {
"content": "@body('Send_HTTP_GET_Hosts_Request')",
"schema": {
"count": {
"type": "integer"
},
"hosts": {
"items": {
"properties": {
"apis_detected": {
"type": "boolean"
},
"asset_id": {
"type": "integer"
},
"hostnames": {
"type": "array"
},
"id": {
"type": "integer"
},
"label": {
"type": "string"
},
"location": {
"type": "string"
},
"os_name": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"total": {
"type": "integer"
}
}
}
},
"Send_HTTP_GET_Hosts_Request": {
"runAfter": {
"Initialize_Ingested_Hosts_Variable": [
"Succeeded"
]
},
"type": "Http",
"inputs": {
"authentication": {
"password": "[parameters('EdgescanPassword')]",
"type": "Basic",
"username": "[parameters('EdgescanUsername')]"
},
"method": "GET",
"uri": "[concat('https://', parameters('EdgescanURL'), '/api/v1/hosts.json')]"
},
"description": "Grab hosts"
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azureloganalyticsdatacollector": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('azureloganalyticsdatacollector'))]",
"connectionName": "azureloganalyticsdatacollector",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azureloganalyticsdatacollector')]"
}
}
}
}
}
}
]
}