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

287 строки
15 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 asset records created in Edgescan in the last two days. If these records are not in the Azure Sentinel edgescan_assets custom log, they will be added.",
"author": "Arbala Security"
},
"parameters": {
"PlaybookName": {
"defaultValue": "edgescan_assets",
"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_Asset": {
"foreach": "@body('Parse_JSON')?['assets']",
"actions": {
"Send_Data": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": "@{items('For_Each_Asset')}",
"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_Assets_Variable": {
"runAfter": {},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "Ingested Assets",
"type": "string"
}
]
}
},
"Parse_JSON": {
"runAfter": {
"Send_HTTP_GET_Assets_Request": [
"Succeeded"
]
},
"type": "ParseJson",
"inputs": {
"content": "@body('Send_HTTP_GET_Assets_Request')",
"schema": {
"assets": {
"items": {
"properties": {
"active_licence": {
"properties": {
"asset_id": {
"type": "integer"
},
"end_date": {
"type": "string"
},
"expired": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"licence_type_name": {
"type": "string"
},
"name": {
"type": "string"
},
"start_date": {
"type": "string"
},
"status": {
"type": "string"
}
},
"type": "object"
},
"authenticated": {
"type": "boolean"
},
"created_at": {
"type": "string"
},
"current_assessment": {
"properties": {
"created_at": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"type": "string"
}
},
"type": "object"
},
"host_count": {
"type": "integer"
},
"hostname": {
"type": "string"
},
"id": {
"type": "integer"
},
"last_host_scan": {},
"linked_assets": {
"type": "array"
},
"location_specifiers": {
"items": {
"properties": {
"id": {
"type": "integer"
},
"location": {
"type": "string"
},
"location_type": {
"type": "string"
}
},
"required": [
"id",
"location",
"location_type"
],
"type": "object"
},
"type": "array"
},
"name": {
"type": "string"
},
"network_access": {
"type": "string"
},
"pci_enabled": {
"type": "boolean"
},
"priority": {
"type": "integer"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"type": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"count": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
}
},
"Send_HTTP_GET_Assets_Request": {
"runAfter": {
"Initialize_Ingested_Assets_Variable": [
"Succeeded"
]
},
"type": "Http",
"inputs": {
"authentication": {
"password": "[parameters('EdgescanPassword')]",
"type": "Basic",
"username": "[parameters('EdgescanUsername')]"
},
"method": "GET",
"uri": "[concat('https://', parameters('EdgescanURL'), '/api/v1/assets.json')]"
},
"description": "Grab assets"
}
},
"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')]"
}
}
}
}
}
}
]
}