/
Template.arm.json
152 lines (152 loc) · 7.15 KB
/
Template.arm.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"SentinelWorkspaceName": {
"type": "string",
"metadata": {
"description": "Name of the Sentinel log analytics workspace to connect to"
}
},
"LogicAppName": {
"defaultValue": "logic-REPLACEWITHLOGICAPPNAME",
"type": "String",
"metadata": {
"description": "Name of the logic app to create"
}
},
"SentinelConnectionName": {
"defaultValue": "connection-REPLACEWITHLOGICAPPNAME",
"type": "string",
"metadata": {
"description": "Name of the API connection to create"
}
},
"SentinelResourceGroupName": {
"defaultValue": "[resourceGroup().name]",
"type": "string",
"metadata": {
"description": "Name of the Sentinel resource group, if different from the resource group where the logic app is deployed"
}
}
},
"variables": {
"MiRoleAssignmentId": "[guid(concat(resourceGroup().id, parameters('SentinelConnectionName')))]",
"SentinelResponderRoleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '3e150937-b8fe-4cfb-8069-0eaf05ecd056')]",
"SentinelConnectionApiId": "[concat('/subscriptions/',subscription().subscriptionId,'/providers/Microsoft.Web/locations/',resourceGroup().location,'/managedApis/azuresentinel')]",
"SentinelConnectionId": "[concat(resourceGroup().id, '/providers/Microsoft.Web/connections/', parameters('SentinelConnectionName'))]",
"ArmIncidentPrefix": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('SentinelResourceGroupName'), '/providers/Microsoft.OperationalInsights/workspaces/', parameters('SentinelWorkspaceName'), '/providers/Microsoft.SecurityInsights/Incidents/')]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('SentinelConnectionName')]",
"location": "[resourceGroup().location]",
"kind": "V1",
"properties": {
"displayName": "[parameters('SentinelConnectionName')]",
"api": {
"name": "azuresentinel",
"displayName": "Microsoft Sentinel",
"description": "Cloud-native SIEM with a built-in AI so you can focus on what matters most",
"iconUri": "https://connectoricons-prod.azureedge.net/releases/v1.0.1645/1.0.1645.3345/azuresentinel/icon.png",
"brandColor": "#0072C6",
"id": "[variables('SentinelConnectionApiId')]",
"type": "Microsoft.Web/locations/managedApis"
},
"customParameterValues": {},
"alternativeParameterValues": {},
"parameterValueType": "Alternative"
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('LogicAppName')]",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('SentinelConnectionName'))]"
],
"location": "[resourceGroup().location]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Microsoft_Sentinel_incident": {
"inputs": {
"body": {
"callback_url": "@{listCallbackUrl()}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azuresentinel']['connectionId']"
}
},
"path": "/incident-creation"
},
"type": "ApiConnectionWebhook"
}
}
},
"parameters": {
"$connections": {
"value": {
"azuresentinel": {
"connectionId": "[variables('SentinelConnectionId')]",
"connectionName": "[parameters('SentinelConnectionName')]",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
},
"id": "[variables('SentinelConnectionApiId')]"
}
}
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
"name": "nested-role-assignment",
"resourceGroup": "[parameters('SentinelResourceGroupName')]",
"subscriptionId": "[subscription().subscriptionId]",
"dependsOn": [
"[resourceId('Microsoft.Logic/workflows', parameters('LogicAppName'))]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"name": "[variables('MiRoleAssignmentId')]",
"properties": {
"roleDefinitionId": "[variables('SentinelResponderRoleDefinitionId')]",
"principalId": "[reference(resourceId(subscription().subscriptionId, resourceGroup().name,'Microsoft.Logic/workflows', parameters('LogicAppName')), '2019-05-01', 'full').identity.principalId]",
"principalType": "ServicePrincipal"
}
}
]
}
}
}
]
}