176 строки
8.1 KiB
JSON
176 строки
8.1 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"metadata": {
|
|
"title": "AS-Azure-AD-Group",
|
|
"description": "This playbook is intended to be run from a Microsoft Sentinel incident. It will add the users associated with the accounts from Microsoft Sentinel incidents to an Azure Active Directory Group of your choosing.",
|
|
"lastUpdateTime": "2022-10-17T18:18:05Z",
|
|
"entities": ["Account"],
|
|
"tags": ["Microsoft Sentinel", "Incident", "Azure Active Directory", "Groups"],
|
|
"support": {
|
|
"tier": "developer"
|
|
},
|
|
"author": {
|
|
"name": "Accelerynt"
|
|
}
|
|
},
|
|
"parameters": {
|
|
"PlaybookName": {
|
|
"defaultValue": "AS-Azure-AD-Group",
|
|
"type": "string"
|
|
},
|
|
"GroupId": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Id of the Azure Active Directory group account users will be added to"
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"azuread": "[concat('azuread-', parameters('PlaybookName'))]",
|
|
"azuresentinel": "[concat('azuresentinel-', parameters('PlaybookName'))]"
|
|
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Web/connections",
|
|
"apiVersion": "2016-06-01",
|
|
"name": "[variables('azuread')]",
|
|
"location": "[resourceGroup().location]",
|
|
"kind": "V1",
|
|
"properties": {
|
|
"displayName": "[parameters('PlaybookName')]",
|
|
"customParameterValues": {},
|
|
"api": {
|
|
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuread')]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Web/connections",
|
|
"apiVersion": "2016-06-01",
|
|
"name": "[variables('azuresentinel')]",
|
|
"location": "[resourceGroup().location]",
|
|
"kind": "V1",
|
|
"properties": {
|
|
"displayName": "[parameters('PlaybookName')]",
|
|
"customParameterValues": {},
|
|
"parameterValueType": "Alternative",
|
|
"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"
|
|
},
|
|
"identity": {
|
|
"type": "SystemAssigned"
|
|
},
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Web/connections', variables('azuread'))]",
|
|
"[resourceId('Microsoft.Web/connections', variables('azuresentinel'))]"
|
|
],
|
|
"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": {
|
|
"Microsoft_Sentinel_incident": {
|
|
"type": "ApiConnectionWebhook",
|
|
"inputs": {
|
|
"body": {
|
|
"callback_url": "@{listCallbackUrl()}"
|
|
},
|
|
"host": {
|
|
"connection": {
|
|
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
|
|
}
|
|
},
|
|
"path": "/incident-creation"
|
|
}
|
|
}
|
|
},
|
|
"actions": {
|
|
"Entities_-_Get_Accounts": {
|
|
"runAfter": {},
|
|
"type": "ApiConnection",
|
|
"inputs": {
|
|
"body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
|
|
"host": {
|
|
"connection": {
|
|
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
|
|
}
|
|
},
|
|
"method": "post",
|
|
"path": "/entities/account"
|
|
}
|
|
},
|
|
"For_each": {
|
|
"foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
|
|
"actions": {
|
|
"Add_user_to_group": {
|
|
"runAfter": {},
|
|
"type": "ApiConnection",
|
|
"inputs": {
|
|
"body": {
|
|
"@@odata.id": "@items('For_each')?['AadUserId']"
|
|
},
|
|
"host": {
|
|
"connection": {
|
|
"name": "@parameters('$connections')['azuread']['connectionId']"
|
|
}
|
|
},
|
|
"method": "post",
|
|
"path": "[concat('/v1.0/groups/@{encodeURIComponent(''', parameters('GroupId'), ''')}/members/$ref')]"
|
|
}
|
|
}
|
|
},
|
|
"runAfter": {
|
|
"Entities_-_Get_Accounts": [
|
|
"Succeeded"
|
|
]
|
|
},
|
|
"type": "Foreach"
|
|
}
|
|
},
|
|
"outputs": {}
|
|
},
|
|
"parameters": {
|
|
"$connections": {
|
|
"value": {
|
|
"azuread": {
|
|
"connectionId": "[resourceId('Microsoft.Web/connections', variables('azuread'))]",
|
|
"connectionName": "[variables('azuread')]",
|
|
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuread')]"
|
|
},
|
|
"azuresentinel": {
|
|
"connectionId": "[resourceId('Microsoft.Web/connections', variables('azuresentinel'))]",
|
|
"connectionName": "[variables('azuresentinel')]",
|
|
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuresentinel')]",
|
|
"connectionProperties": {
|
|
"authentication": {
|
|
"type": "ManagedServiceIdentity"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|