Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Azure
GitHub Repository: Azure/Azure-Sentinel-Notebooks
Path: blob/master/scenario-notebooks/Automated-Notebooks/DeploymentTemplate.json
3253 views
1
{
2
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
3
"contentVersion": "1.0.0.0",
4
"parameters": {
5
"vmName": {
6
"type": "string",
7
"defaultValue": "autonotebook",
8
"metadata": {
9
"description": "The name of your Virtual Machine used to execute notebooks."
10
}
11
},
12
"adminUsername": {
13
"type": "string",
14
"defaultValue" : "azureuser",
15
"metadata": {
16
"description": "Username for the Virtual Machine."
17
}
18
},
19
"authenticationType": {
20
"type": "string",
21
"defaultValue" : "sshPublicKey",
22
"allowedValues": [
23
"sshPublicKey",
24
"password"
25
],
26
"metadata": {
27
"description": "Type of authentication to use on the Virtual Machine. SSH key is recommended."
28
}
29
},
30
"adminPasswordOrKey": {
31
"type": "securestring",
32
"metadata": {
33
"description": "SSH Key or password for the Virtual Machine. SSH key is recommended."
34
}
35
},
36
"ubuntuOSVersion": {
37
"type": "string",
38
"defaultValue": "18.04-LTS",
39
"allowedValues": [
40
"12.04.5-LTS",
41
"14.04.5-LTS",
42
"16.04.0-LTS",
43
"18.04-LTS"
44
],
45
"metadata": {
46
"description": "The Ubuntu version for the VM. This will pick a fully patched image of this given Ubuntu version."
47
}
48
},
49
"VmSize": {
50
"type": "string",
51
"defaultValue": "Standard_B2s",
52
"metadata": {
53
"description": "The size of the VM"
54
}
55
},
56
"SentinelRG" :{
57
"type": "string",
58
"metadata": {
59
"description": "The name of the Resource Group the Microsoft Sentinel Workspace is in - change if RG is different from RG this VM is being deployed in"
60
}
61
},
62
"SentinelSub" :{
63
"type": "string",
64
"metadata": {
65
"description": "The ID of the subscription the Microsoft Sentinel Workspace is in - change if RG is different from RG this VM is being deployed in"
66
}
67
},
68
"AzureMLSub" :{
69
"type": "string",
70
"metadata": {
71
"description": "The ID of the subscription the Azure ML Workspace is in - change if RG is different from RG this VM is being deployed in"
72
}
73
},
74
"AzureMLRG" :{
75
"type": "string",
76
"metadata": {
77
"description": "The name of the Resource Group the Azure ML Workspace is in - change if RG is different from RG this VM is being deployed in"
78
}
79
},
80
"builtInRoleType1": {
81
"type": "string",
82
"defaultValue": "Microsoft Sentinel Responder"
83
},
84
"builtInRoleType2": {
85
"type": "string",
86
"defaultValue": "Reader"
87
}
88
},
89
"variables": {
90
"rbac1Scope": "[concat('/subscriptions/', parameters('SentinelSub'), '/resourceGroups/', parameters('SentinelRG'))]",
91
"rbac2Scope": "[concat('/subscriptions/', parameters('AzureMLSub'), '/resourceGroups/', parameters('AzureMLRG'))]",
92
"virtualNetworkName": "[concat(parameters('vmName'),'-VNET')]",
93
"subnetName": "[concat(parameters('vmName'),'-subnet')]",
94
"vmResourceId": "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]",
95
"Reader": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]",
96
"Microsoft Sentinel Responder": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '3e150937-b8fe-4cfb-8069-0eaf05ecd056')]",
97
"publicIpAddressName": "[concat(parameters('vmName'), 'PublicIP' )]",
98
"networkInterfaceName": "[concat(parameters('vmName'),'NetInt')]",
99
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
100
"osDiskType": "Standard_LRS",
101
"subnetAddressPrefix": "10.1.0.0/24",
102
"addressPrefix": "10.1.0.0/16",
103
"dnsLabelPrefix": "[toLower(concat('autonotebooks-', uniqueString(resourceGroup().id)))]",
104
"networkSecurityGroupName": "[concat(parameters('vmName'),'-NSG')]",
105
"rbacGuid1": "[guid(subscription().subscriptionId, deployment().name)]",
106
"rbacGuid2": "[guid(resourceGroup().id, deployment().name)]",
107
"linuxConfiguration": {
108
"disablePasswordAuthentication": true,
109
"ssh": {
110
"publicKeys": [
111
{
112
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
113
"keyData": "[parameters('adminPasswordOrKey')]"
114
}
115
]
116
}
117
}
118
},
119
"resources": [
120
{
121
"type": "Microsoft.Network/networkInterfaces",
122
"apiVersion": "2020-06-01",
123
"name": "[variables('networkInterfaceName')]",
124
"location": "[resourceGroup().location]",
125
"dependsOn": [
126
"[resourceId('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]",
127
"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
128
"[resourceId('Microsoft.Network/publicIpAddresses/', variables('publicIpAddressName'))]"
129
],
130
"properties": {
131
"ipConfigurations": [
132
{
133
"name": "ipconfig1",
134
"properties": {
135
"subnet": {
136
"id": "[variables('subnetRef')]"
137
},
138
"privateIPAllocationMethod": "Dynamic",
139
"publicIpAddress": {
140
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
141
}
142
}
143
}
144
],
145
"networkSecurityGroup": {
146
"id": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupName'))]"
147
}
148
}
149
},
150
{
151
"type": "Microsoft.Network/networkSecurityGroups",
152
"apiVersion": "2020-06-01",
153
"name": "[variables('networkSecurityGroupName')]",
154
"location": "[resourceGroup().location]",
155
"properties": {
156
"securityRules": [
157
{
158
"name": "SSH",
159
"properties": {
160
"priority": 1000,
161
"protocol": "TCP",
162
"access": "Allow",
163
"direction": "Inbound",
164
"sourceAddressPrefix": "*",
165
"sourcePortRange": "*",
166
"destinationAddressPrefix": "*",
167
"destinationPortRange": "22"
168
}
169
}
170
]
171
}
172
},
173
{
174
"type": "Microsoft.Network/virtualNetworks",
175
"apiVersion": "2020-06-01",
176
"name": "[variables('virtualNetworkName')]",
177
"location": "[resourceGroup().location]",
178
"properties": {
179
"addressSpace": {
180
"addressPrefixes": [
181
"[variables('addressPrefix')]"
182
]
183
},
184
"subnets": [
185
{
186
"name": "[variables('subnetName')]",
187
"properties": {
188
"addressPrefix": "[variables('subnetAddressPrefix')]",
189
"privateEndpointNetworkPolicies": "Enabled",
190
"privateLinkServiceNetworkPolicies": "Enabled"
191
}
192
}
193
]
194
}
195
},
196
{
197
"type": "Microsoft.Network/publicIpAddresses",
198
"apiVersion": "2020-06-01",
199
"name": "[variables('publicIpAddressName')]",
200
"location": "[resourceGroup().location]",
201
"sku": {
202
"name": "Basic",
203
"tier": "Regional"
204
},
205
"properties": {
206
"publicIpAllocationMethod": "Dynamic",
207
"publicIPAddressVersion": "IPv4",
208
"dnsSettings": {
209
"domainNameLabel": "[variables('dnsLabelPrefix')]"
210
},
211
"idleTimeoutInMinutes": 4
212
}
213
},
214
{
215
"type": "Microsoft.Compute/virtualMachines",
216
"apiVersion": "2020-06-01",
217
"name": "[parameters('vmName')]",
218
"location": "[resourceGroup().location]",
219
"identity": {
220
"type": "SystemAssigned"
221
},
222
"dependsOn": [
223
"[resourceId('Microsoft.Network/networkInterfaces/', variables('networkInterfaceName'))]"
224
],
225
"properties": {
226
"hardwareProfile": {
227
"vmSize": "[parameters('VmSize')]"
228
},
229
"storageProfile": {
230
"osDisk": {
231
"createOption": "fromImage",
232
"managedDisk": {
233
"storageAccountType": "[variables('osDiskType')]"
234
}
235
},
236
"imageReference": {
237
"publisher": "Canonical",
238
"offer": "UbuntuServer",
239
"sku": "[parameters('ubuntuOSVersion')]",
240
"version": "latest"
241
}
242
},
243
"networkProfile": {
244
"networkInterfaces": [
245
{
246
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
247
}
248
]
249
},
250
"osProfile": {
251
"computerName": "[parameters('vmName')]",
252
"adminUsername": "[parameters('adminUsername')]",
253
"adminPassword": "[parameters('adminPasswordOrKey')]",
254
"linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), json('null'), variables('linuxConfiguration'))]"
255
}
256
}
257
},
258
{
259
"apiVersion": "2020-10-01",
260
"name": "assignRole",
261
"type": "Microsoft.Resources/deployments",
262
"subscriptionId": "[parameters('SentinelSub')]",
263
"resourceGroup": "[parameters('SentinelRG')]",
264
"properties": {
265
"mode": "Incremental",
266
"template": {
267
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
268
"contentVersion": "1.0.0.0",
269
"resources": [
270
{
271
"name": "[guid(variables('rbacGuid1'))]",
272
"type": "Microsoft.Authorization/roleAssignments",
273
"apiVersion": "2017-09-01",
274
"properties": {
275
"roleDefinitionId": "[variables(parameters('builtInRoleType1'))]",
276
"principalId": "[reference(variables('vmResourceId'), '2017-12-01', 'Full').identity.principalId]",
277
"scope": ""
278
}
279
}
280
]
281
}
282
}
283
},
284
{
285
"apiVersion": "2020-10-01",
286
"name": "assignRole2",
287
"type": "Microsoft.Resources/deployments",
288
"subscriptionId": "[parameters('AzureMLSub')]",
289
"resourceGroup": "[parameters('AzureMLRG')]",
290
"properties": {
291
"mode": "Incremental",
292
"template": {
293
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
294
"contentVersion": "1.0.0.0",
295
"resources": [
296
{
297
"name": "[guid(variables('rbacGuid2'))]",
298
"type": "Microsoft.Authorization/roleAssignments",
299
"apiVersion": "2017-09-01",
300
"properties": {
301
"roleDefinitionId": "[variables(parameters('builtInRoleType2'))]",
302
"principalId": "[reference(variables('vmResourceId'), '2017-12-01', 'Full').identity.principalId]",
303
"scope": ""
304
}
305
}
306
]
307
}
308
}
309
}
310
],
311
"outputs": {
312
"adminUsername": {
313
"type": "string",
314
"value": "[parameters('adminUsername')]"
315
},
316
"hostname": {
317
"type": "string",
318
"value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
319
},
320
"sshCommand": {
321
"type": "string",
322
"value": "[concat('ssh ', parameters('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]"
323
}
324
}
325
}
326