-
Notifications
You must be signed in to change notification settings - Fork 143
/
Copy pathmlz.bicep
650 lines (582 loc) · 27 KB
/
mlz.bicep
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
// scope
targetScope = 'subscription'
// main
//// scaffolding
module hubResourceGroup './modules/resourceGroup.bicep' = {
name: 'deploy-rg-hub-${nowUtc}'
scope: subscription(hubSubscriptionId)
params: {
name: hubResourceGroupName
location: hubLocation
}
}
module spokeResourceGroups './modules/resourceGroup.bicep' = [for spoke in spokes: {
name: 'deploy-rg-${spoke.name}-${nowUtc}'
scope: subscription(spoke.subscriptionId)
params: {
name: spoke.resourceGroupName
location: spoke.location
tags: tags
}
}]
//// log analytics workspace
module logAnalyticsWorkspace './modules/logAnalyticsWorkspace.bicep' = {
name: 'deploy-laws-${nowUtc}'
scope: resourceGroup(operationsSubscriptionId, operationsResourceGroupName)
params: {
name: logAnalyticsWorkspaceName
location: logAnalyticsWorkspaceLocation
tags: tags
retentionInDays: logAnalyticsWorkspaceRetentionInDays
skuName: logAnalyticsWorkspaceSkuName
workspaceCappingDailyQuotaGb: logAnalyticsWorkspaceCappingDailyQuotaGb
}
dependsOn: [
spokeResourceGroups
]
}
//// hub and spoke networks
module hubNetwork './modules/hubNetwork.bicep' = {
name: 'deploy-vnet-hub-${nowUtc}'
scope: resourceGroup(hubSubscriptionId, hubResourceGroupName)
params: {
location: hubLocation
tags: tags
logStorageAccountName: hubLogStorageAccountName
logStorageSkuName: hubLogStorageSkuName
logAnalyticsWorkspaceName: logAnalyticsWorkspaceName
logAnalyticsWorkspaceResourceId: logAnalyticsWorkspace.outputs.id
virtualNetworkName: hubVirtualNetworkName
virtualNetworkAddressPrefix: hubVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: hubVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: hubVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: hubNetworkSecurityGroupName
networkSecurityGroupRules: hubNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: hubNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: hubNetworkSecurityGroupDiagnosticsMetrics
subnetName: hubSubnetName
subnetAddressPrefix: hubSubnetAddressPrefix
subnetServiceEndpoints: hubSubnetServiceEndpoints
firewallName: firewallName
firewallSkuTier: firewallSkuTier
firewallPolicyName: firewallPolicyName
firewallThreatIntelMode: firewallThreatIntelMode
firewallDiagnosticsLogs: firewallDiagnosticsLogs
firewallDiagnosticsMetrics: firewallDiagnosticsMetrics
firewallClientIpConfigurationName: firewallClientIpConfigurationName
firewallClientSubnetName: firewallClientSubnetName
firewallClientSubnetAddressPrefix: firewallClientSubnetAddressPrefix
firewallClientSubnetServiceEndpoints: firewallClientSubnetServiceEndpoints
firewallClientPublicIPAddressName: firewallClientPublicIPAddressName
firewallClientPublicIPAddressSkuName: firewallClientPublicIPAddressSkuName
firewallClientPublicIpAllocationMethod: firewallClientPublicIpAllocationMethod
firewallClientPublicIPAddressAvailabilityZones: firewallClientPublicIPAddressAvailabilityZones
firewallManagementIpConfigurationName: firewallManagementIpConfigurationName
firewallManagementSubnetName: firewallManagementSubnetName
firewallManagementSubnetAddressPrefix: firewallManagementSubnetAddressPrefix
firewallManagementSubnetServiceEndpoints: firewallManagementSubnetServiceEndpoints
firewallManagementPublicIPAddressName: firewallManagementPublicIPAddressName
firewallManagementPublicIPAddressSkuName: firewallManagementPublicIPAddressSkuName
firewallManagementPublicIpAllocationMethod: firewallManagementPublicIpAllocationMethod
firewallManagementPublicIPAddressAvailabilityZones: firewallManagementPublicIPAddressAvailabilityZones
publicIPAddressDiagnosticsLogs: publicIPAddressDiagnosticsLogs
publicIPAddressDiagnosticsMetrics: publicIPAddressDiagnosticsMetrics
}
}
module spokeNetworks './modules/spokeNetwork.bicep' = [ for spoke in spokes: {
name: 'deploy-vnet-${spoke.name}-${nowUtc}'
scope: resourceGroup(spoke.subscriptionId, spoke.resourceGroupName)
params: {
location: spoke.location
tags: tags
logStorageAccountName: spoke.logStorageAccountName
logStorageSkuName: spoke.logStorageSkuName
logAnalyticsWorkspaceResourceId: logAnalyticsWorkspace.outputs.id
firewallPrivateIPAddress: hubNetwork.outputs.firewallPrivateIPAddress
virtualNetworkName: spoke.virtualNetworkName
virtualNetworkAddressPrefix: spoke.virtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: spoke.virtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: spoke.virtualNetworkDiagnosticsMetrics
networkSecurityGroupName: spoke.networkSecurityGroupName
networkSecurityGroupRules: spoke.networkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: spoke.networkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: spoke.networkSecurityGroupDiagnosticsMetrics
subnetName: spoke.subnetName
subnetAddressPrefix: spoke.subnetAddressPrefix
subnetServiceEndpoints: spoke.subnetServiceEndpoints
}
}]
//// virtual network peering
module hubVirtualNetworkPeerings './modules/hubNetworkPeerings.bicep' = {
name: 'deploy-vnet-peerings-hub-${nowUtc}'
scope: resourceGroup(hubSubscriptionId, hubResourceGroupName)
params: {
hubVirtualNetworkName: hubNetwork.outputs.virtualNetworkName
spokes: [ for (spoke, i) in spokes: {
type: spoke.name
virtualNetworkName: spokeNetworks[i].outputs.virtualNetworkName
virtualNetworkResourceId: spokeNetworks[i].outputs.virtualNetworkResourceId
}]
}
}
module spokeVirtualNetworkPeerings './modules/spokeNetworkPeering.bicep' = [ for (spoke, i) in spokes: {
name: 'deploy-vnet-peerings-${spoke.name}-${nowUtc}'
scope: subscription(spoke.subscriptionId)
params: {
spokeName: spoke.name
spokeResourceGroupName: spoke.resourceGroupName
spokeVirtualNetworkName: spokeNetworks[i].outputs.virtualNetworkName
hubVirtualNetworkName: hubNetwork.outputs.virtualNetworkName
hubVirtualNetworkResourceId: hubNetwork.outputs.virtualNetworkResourceId
}
}]
//// resource group policy assignments
module hubPolicyAssignment './modules/policyAssignment.bicep' = if(deployPolicy) {
name: 'assign-policy-hub-${nowUtc}'
scope: resourceGroup(hubSubscriptionId, hubResourceGroupName)
params: {
builtInAssignment: policy
logAnalyticsWorkspaceName: logAnalyticsWorkspace.outputs.name
logAnalyticsWorkspaceResourceGroupName: logAnalyticsWorkspace.outputs.resourceGroupName
operationsSubscriptionId: operationsSubscriptionId
}
}
module spokePolicyAssignments './modules/policyAssignment.bicep' = [ for spoke in spokes: if(deployPolicy) {
name: 'assign-policy-${spoke.name}-${nowUtc}'
scope: resourceGroup(spoke.subscriptionId, spoke.resourceGroupName)
params: {
builtInAssignment: policy
logAnalyticsWorkspaceName: logAnalyticsWorkspace.outputs.name
logAnalyticsWorkspaceResourceGroupName: logAnalyticsWorkspace.outputs.resourceGroupName
operationsSubscriptionId: operationsSubscriptionId
}
}]
//// central logging per subscription if different per hub/spoke
module hubSubscriptionActivityLogging './modules/centralLogging.bicep' = {
name: 'activity-logs-hub-${nowUtc}'
scope: subscription(hubSubscriptionId)
params: {
diagnosticSettingName: 'log-hub-sub-activity-to-${logAnalyticsWorkspace.outputs.name}'
logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.id
}
dependsOn: [
hubNetwork
]
}
module spokeSubscriptionActivityLogging './modules/centralLogging.bicep' = [ for spoke in spokes: if(spoke.subscriptionId != hubSubscriptionId) {
name: 'activity-logs-${spoke.name}-${nowUtc}'
scope: subscription(spoke.subscriptionId)
params: {
diagnosticSettingName: 'log-${spoke.name}-sub-activity-to-${logAnalyticsWorkspace.outputs.name}'
logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.id
}
dependsOn: [
spokeNetworks
]
}]
//// log analytics workspace diagnostic logging
module logAnalyticsDiagnosticLogging './modules/logAnalyticsDiagnosticLogging.bicep' = {
name: 'deploy-diagnostic-logging-LAWS'
scope: resourceGroup(operationsSubscriptionId, operationsResourceGroupName)
params: {
diagnosticStorageAccountName: operationsLogStorageAccountName
logAnalyticsWorkspaceName: logAnalyticsWorkspace.outputs.name
enableDiagnostics: true
}
dependsOn: [
hubNetwork
spokeNetworks
]
}
// security center per subscription if different per hub/spoke
module hubSecurityCenter './modules/securityCenter.bicep' = if(deployASC) {
name: 'set-hub-sub-security-center'
scope: subscription(hubSubscriptionId)
params: {
logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.id
emailSecurityContact: emailSecurityContact
}
}
module spokeSecurityCenter './modules/securityCenter.bicep' = [ for spoke in spokes: if( (deployASC) && (spoke.subscriptionId != hubSubscriptionId) ) {
name: 'set-${spoke.name}-sub-security-center'
scope: subscription(operationsSubscriptionId)
params: {
logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.id
emailSecurityContact: emailSecurityContact
}
}]
//// remote access
module remoteAccess './modules/remoteAccess.bicep' = if(deployRemoteAccess) {
name: 'deploy-remote-access-${nowUtc}'
scope: resourceGroup(hubSubscriptionId, hubResourceGroupName)
params: {
location: hubLocation
hubVirtualNetworkName: hubNetwork.outputs.virtualNetworkName
hubSubnetResourceId: hubNetwork.outputs.subnetResourceId
hubNetworkSecurityGroupResourceId: hubNetwork.outputs.networkSecurityGroupResourceId
bastionHostName: bastionHostName
bastionHostSubnetAddressPrefix: bastionHostSubnetAddressPrefix
bastionHostPublicIPAddressName: bastionHostPublicIPAddressName
bastionHostPublicIPAddressSkuName: bastionHostPublicIPAddressSkuName
bastionHostPublicIPAddressAllocationMethod: bastionHostPublicIPAddressAllocationMethod
bastionHostPublicIPAddressAvailabilityZones: bastionHostPublicIPAddressAvailabilityZones
bastionHostIPConfigurationName: bastionHostIPConfigurationName
linuxNetworkInterfaceName: linuxNetworkInterfaceName
linuxNetworkInterfaceIpConfigurationName: linuxNetworkInterfaceIpConfigurationName
linuxNetworkInterfacePrivateIPAddressAllocationMethod: linuxNetworkInterfacePrivateIPAddressAllocationMethod
linuxVmName: linuxVmName
linuxVmSize: linuxVmSize
linuxVmOsDiskCreateOption: linuxVmOsDiskCreateOption
linuxVmOsDiskType: linuxVmOsDiskType
linuxVmImagePublisher: linuxVmImagePublisher
linuxVmImageOffer: linuxVmImageOffer
linuxVmImageSku: linuxVmImageSku
linuxVmImageVersion: linuxVmImageVersion
linuxVmAdminUsername: linuxVmAdminUsername
linuxVmAuthenticationType: linuxVmAuthenticationType
linuxVmAdminPasswordOrKey: linuxVmAdminPasswordOrKey
windowsNetworkInterfaceName: windowsNetworkInterfaceName
windowsNetworkInterfaceIpConfigurationName: windowsNetworkInterfaceIpConfigurationName
windowsNetworkInterfacePrivateIPAddressAllocationMethod: windowsNetworkInterfacePrivateIPAddressAllocationMethod
windowsVmName: windowsVmName
windowsVmSize: windowsVmSize
windowsVmAdminUsername: windowsVmAdminUsername
windowsVmAdminPassword: windowsVmAdminPassword
windowsVmPublisher: windowsVmPublisher
windowsVmOffer: windowsVmOffer
windowsVmSku: windowsVmSku
windowsVmVersion: windowsVmVersion
windowsVmCreateOption: windowsVmCreateOption
windowsVmStorageAccountType: windowsVmStorageAccountType
logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.id
}
}
// parameters
@minLength(3)
@maxLength(24)
@description('A name (3-24 alphanumeric characters in length without whitespace) used to prefix resources and generate uniqueness for resources with globally unique naming requirements like Storage Accounts and Log Analytics Workspaces')
param resourcePrefix string = 'mlz-${uniqueId}'
param hubSubscriptionId string = subscription().subscriptionId
param identitySubscriptionId string = hubSubscriptionId
param operationsSubscriptionId string = hubSubscriptionId
param sharedServicesSubscriptionId string = hubSubscriptionId
@allowed([
'Standard'
'Premium'
])
param firewallSkuTier string = 'Premium'
param hubResourceGroupName string = '${resourcePrefix}-hub'
param hubLocation string = deployment().location
param hubVirtualNetworkName string = 'hub-vnet'
param hubSubnetName string = 'hub-subnet'
param hubVirtualNetworkAddressPrefix string = '10.0.100.0/24'
param hubSubnetAddressPrefix string = '10.0.100.128/27'
param hubVirtualNetworkDiagnosticsLogs array = []
param hubVirtualNetworkDiagnosticsMetrics array = []
param hubNetworkSecurityGroupName string = 'hub-nsg'
param hubNetworkSecurityGroupRules array = [
{
name: 'allow_ssh'
properties: {
description: 'Allow SSH access from anywhere'
access: 'Allow'
priority: 100
protocol: 'Tcp'
direction: 'Inbound'
sourcePortRange: '*'
sourceAddressPrefix: '*'
destinationPortRange: '22'
destinationAddressPrefix: '*'
}
}
{
name: 'allow_rdp'
properties: {
description: 'Allow RDP access from anywhere'
access: 'Allow'
priority: 200
protocol: 'Tcp'
direction: 'Inbound'
sourcePortRange: '*'
sourceAddressPrefix: '*'
destinationPortRange: '3389'
destinationAddressPrefix: '*'
}
}
]
param hubNetworkSecurityGroupDiagnosticsLogs array = [
{
category: 'NetworkSecurityGroupEvent'
enabled: true
}
{
category: 'NetworkSecurityGroupRuleCounter'
enabled: true
}
]
param hubNetworkSecurityGroupDiagnosticsMetrics array = []
param hubSubnetServiceEndpoints array = [
{
service: 'Microsoft.Storage'
}
]
param hubLogStorageAccountName string = toLower(take('hublogs${uniqueId}', 24))
param hubLogStorageSkuName string = 'Standard_GRS'
param firewallName string = 'firewall'
param firewallManagementSubnetAddressPrefix string = '10.0.100.64/26'
param firewallClientSubnetAddressPrefix string = '10.0.100.0/26'
param firewallPolicyName string = 'firewall-policy'
param firewallThreatIntelMode string = 'Alert'
param firewallDiagnosticsLogs array = [
{
category: 'AzureFirewallApplicationRule'
enabled: true
}
{
category: 'AzureFirewallNetworkRule'
enabled: true
}
{
category: 'AzureFirewallDnsProxy'
enabled: true
}
]
param firewallDiagnosticsMetrics array = [
{
category: 'AllMetrics'
enabled: true
}
]
var firewallClientSubnetName = 'AzureFirewallSubnet' //this must be 'AzureFirewallSubnet'
param firewallClientIpConfigurationName string = 'firewall-client-ip-config'
param firewallClientSubnetServiceEndpoints array = []
param firewallClientPublicIPAddressName string = 'firewall-client-public-ip'
param firewallClientPublicIPAddressSkuName string = 'Standard'
param firewallClientPublicIpAllocationMethod string = 'Static'
param firewallClientPublicIPAddressAvailabilityZones array = []
var firewallManagementSubnetName = 'AzureFirewallManagementSubnet' //this must be 'AzureFirewallManagementSubnet'
param firewallManagementIpConfigurationName string = 'firewall-management-ip-config'
param firewallManagementSubnetServiceEndpoints array = []
param firewallManagementPublicIPAddressName string = 'firewall-management-public-ip'
param firewallManagementPublicIPAddressSkuName string = 'Standard'
param firewallManagementPublicIpAllocationMethod string = 'Static'
param firewallManagementPublicIPAddressAvailabilityZones array = []
param publicIPAddressDiagnosticsLogs array = [
{
category: 'DDoSProtectionNotifications'
enabled: true
}
{
category: 'DDoSMitigationFlowLogs'
enabled: true
}
{
category: 'DDoSMitigationReports'
enabled: true
}
]
param publicIPAddressDiagnosticsMetrics array = [
{
category: 'AllMetrics'
enabled: true
}
]
param identityResourceGroupName string = replace(hubResourceGroupName, 'hub', 'identity')
param identityLocation string = hubLocation
param identityVirtualNetworkName string = replace(hubVirtualNetworkName, 'hub', 'identity')
param identitySubnetName string = replace(hubSubnetName, 'hub', 'identity')
param identityVirtualNetworkAddressPrefix string = '10.0.110.0/26'
param identitySubnetAddressPrefix string = '10.0.110.0/27'
param identityVirtualNetworkDiagnosticsLogs array = hubVirtualNetworkDiagnosticsLogs
param identityVirtualNetworkDiagnosticsMetrics array = hubVirtualNetworkDiagnosticsMetrics
param identityNetworkSecurityGroupName string = replace(hubNetworkSecurityGroupName, 'hub', 'identity')
param identityNetworkSecurityGroupRules array = hubNetworkSecurityGroupRules
param identityNetworkSecurityGroupDiagnosticsLogs array = hubNetworkSecurityGroupDiagnosticsLogs
param identityNetworkSecurityGroupDiagnosticsMetrics array = hubNetworkSecurityGroupDiagnosticsMetrics
param identitySubnetServiceEndpoints array = hubSubnetServiceEndpoints
param identityLogStorageAccountName string = toLower(take('idlogs${uniqueId}', 24))
param identityLogStorageSkuName string = hubLogStorageSkuName
param operationsResourceGroupName string = replace(hubResourceGroupName, 'hub', 'operations')
param operationsLocation string = hubLocation
param operationsVirtualNetworkName string = replace(hubVirtualNetworkName, 'hub', 'operations')
param operationsVirtualNetworkAddressPrefix string = '10.0.115.0/26'
param operationsVirtualNetworkDiagnosticsLogs array = hubVirtualNetworkDiagnosticsLogs
param operationsVirtualNetworkDiagnosticsMetrics array = hubVirtualNetworkDiagnosticsMetrics
param operationsNetworkSecurityGroupName string = replace(hubNetworkSecurityGroupName, 'hub', 'operations')
param operationsNetworkSecurityGroupRules array = hubNetworkSecurityGroupRules
param operationsNetworkSecurityGroupDiagnosticsLogs array = hubNetworkSecurityGroupDiagnosticsLogs
param operationsNetworkSecurityGroupDiagnosticsMetrics array = hubNetworkSecurityGroupDiagnosticsMetrics
param operationsSubnetName string = replace(hubSubnetName, 'hub', 'operations')
param operationsSubnetAddressPrefix string = '10.0.115.0/27'
param operationsSubnetServiceEndpoints array = hubSubnetServiceEndpoints
param operationsLogStorageAccountName string = toLower(take('opslogs${uniqueId}', 24))
param operationsLogStorageSkuName string = hubLogStorageSkuName
param sharedServicesResourceGroupName string = replace(hubResourceGroupName, 'hub', 'sharedServices')
param sharedServicesLocation string = hubLocation
param sharedServicesVirtualNetworkName string = replace(hubVirtualNetworkName, 'hub', 'sharedServices')
param sharedServicesSubnetName string = replace(hubSubnetName, 'hub', 'sharedServices')
param sharedServicesVirtualNetworkAddressPrefix string = '10.0.120.0/26'
param sharedServicesSubnetAddressPrefix string = '10.0.120.0/27'
param sharedServicesVirtualNetworkDiagnosticsLogs array = hubVirtualNetworkDiagnosticsLogs
param sharedServicesVirtualNetworkDiagnosticsMetrics array = hubVirtualNetworkDiagnosticsMetrics
param sharedServicesNetworkSecurityGroupName string = replace(hubNetworkSecurityGroupName, 'hub', 'sharedServices')
param sharedServicesNetworkSecurityGroupRules array = hubNetworkSecurityGroupRules
param sharedServicesNetworkSecurityGroupDiagnosticsLogs array = hubNetworkSecurityGroupDiagnosticsLogs
param sharedServicesNetworkSecurityGroupDiagnosticsMetrics array = hubNetworkSecurityGroupDiagnosticsMetrics
param sharedServicesSubnetServiceEndpoints array = hubSubnetServiceEndpoints
param sharedServicesLogStorageAccountName string = toLower(take('shrdSvclogs${uniqueId}', 24))
param sharedServicesLogStorageSkuName string = hubLogStorageSkuName
param logAnalyticsWorkspaceName string = take('${resourcePrefix}-laws', 63)
param logAnalyticsWorkspaceLocation string = operationsLocation
param logAnalyticsWorkspaceCappingDailyQuotaGb int = -1
param logAnalyticsWorkspaceRetentionInDays int = 30
param logAnalyticsWorkspaceSkuName string = 'PerGB2018'
@allowed([
'NIST'
'IL5' // AzureUsGoverment only, trying to deploy IL5 in AzureCloud will switch to NIST
'CMMC'
])
@description('[NIST/IL5/CMMC] Built-in policy assignments to assign, default is NIST. IL5 is only available for AzureUsGovernment and will switch to NIST if tried in AzureCloud.')
param policy string = 'NIST'
param deployPolicy bool = false
@description('Email address of the contact, in the form of [email protected]')
param emailSecurityContact string = ''
param deployASC bool = false
@description('Provision Azure Bastion Host and jumpboxes in this deployment')
param deployRemoteAccess bool = false
param bastionHostName string = 'bastionHost'
param bastionHostSubnetAddressPrefix string = '10.0.100.160/27'
param bastionHostPublicIPAddressName string = 'bastionHostPublicIPAddress'
param bastionHostPublicIPAddressSkuName string = 'Standard'
param bastionHostPublicIPAddressAllocationMethod string = 'Static'
param bastionHostPublicIPAddressAvailabilityZones array = []
param bastionHostIPConfigurationName string = 'bastionHostIPConfiguration'
param linuxNetworkInterfaceName string = 'linuxVmNetworkInterface'
param linuxNetworkInterfaceIpConfigurationName string = 'linuxVmIpConfiguration'
param linuxNetworkInterfacePrivateIPAddressAllocationMethod string = 'Dynamic'
param linuxVmName string = 'linuxVirtualMachine'
param linuxVmSize string = 'Standard_B2s'
param linuxVmOsDiskCreateOption string = 'FromImage'
param linuxVmOsDiskType string = 'Standard_LRS'
param linuxVmImagePublisher string = 'Canonical'
param linuxVmImageOffer string = 'UbuntuServer'
param linuxVmImageSku string = '18.04-LTS'
param linuxVmImageVersion string = 'latest'
param linuxVmAdminUsername string = 'azureuser'
@allowed([
'sshPublicKey'
'password'
])
param linuxVmAuthenticationType string = 'password'
@secure()
@minLength(14)
param linuxVmAdminPasswordOrKey string = deployRemoteAccess ? '' : newGuid()
param windowsNetworkInterfaceName string = 'windowsVmNetworkInterface'
param windowsNetworkInterfaceIpConfigurationName string = 'windowsVmIpConfiguration'
param windowsNetworkInterfacePrivateIPAddressAllocationMethod string = 'Dynamic'
param windowsVmName string = 'windowsVm'
param windowsVmSize string = 'Standard_DS1_v2'
param windowsVmAdminUsername string = 'azureuser'
@secure()
@minLength(14)
param windowsVmAdminPassword string = deployRemoteAccess ? '' : newGuid()
param windowsVmPublisher string = 'MicrosoftWindowsServer'
param windowsVmOffer string = 'WindowsServer'
param windowsVmSku string = '2019-datacenter'
param windowsVmVersion string = 'latest'
param windowsVmCreateOption string = 'FromImage'
param windowsVmStorageAccountType string = 'StandardSSD_LRS'
param tags object = {
'resourcePrefix': resourcePrefix
'DeploymentType': 'MissionLandingZoneARM'
}
param uniqueId string = uniqueString(deployment().name)
param nowUtc string = utcNow()
var spokes = [
{
name: 'operations'
subscriptionId: operationsSubscriptionId
resourceGroupName: operationsResourceGroupName
location: operationsLocation
logStorageAccountName: operationsLogStorageAccountName
logStorageSkuName: operationsLogStorageSkuName
virtualNetworkName: operationsVirtualNetworkName
virtualNetworkAddressPrefix: operationsVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: operationsVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: operationsVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: operationsNetworkSecurityGroupName
networkSecurityGroupRules: operationsNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: operationsNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: operationsNetworkSecurityGroupDiagnosticsMetrics
subnetName: operationsSubnetName
subnetAddressPrefix: operationsSubnetAddressPrefix
subnetServiceEndpoints: operationsSubnetServiceEndpoints
}
{
name: 'identity'
subscriptionId: identitySubscriptionId
resourceGroupName: identityResourceGroupName
location: identityLocation
logStorageAccountName: identityLogStorageAccountName
logStorageSkuName: identityLogStorageSkuName
virtualNetworkName: identityVirtualNetworkName
virtualNetworkAddressPrefix: identityVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: identityVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: identityVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: identityNetworkSecurityGroupName
networkSecurityGroupRules: identityNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: identityNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: identityNetworkSecurityGroupDiagnosticsMetrics
subnetName: identitySubnetName
subnetAddressPrefix: identitySubnetAddressPrefix
subnetServiceEndpoints: identitySubnetServiceEndpoints
}
{
name: 'sharedServices'
subscriptionId: sharedServicesSubscriptionId
resourceGroupName: sharedServicesResourceGroupName
location: sharedServicesLocation
logStorageAccountName: sharedServicesLogStorageAccountName
logStorageSkuName: sharedServicesLogStorageSkuName
virtualNetworkName: sharedServicesVirtualNetworkName
virtualNetworkAddressPrefix: sharedServicesVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: sharedServicesVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: sharedServicesVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: sharedServicesNetworkSecurityGroupName
networkSecurityGroupRules: sharedServicesNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: sharedServicesNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: sharedServicesNetworkSecurityGroupDiagnosticsMetrics
subnetName: sharedServicesSubnetName
subnetAddressPrefix: sharedServicesSubnetAddressPrefix
subnetServiceEndpoints: sharedServicesSubnetServiceEndpoints
}
]
// outputs
output firewallPrivateIPAddress string = hubNetwork.outputs.firewallPrivateIPAddress
output hub object = {
subscriptionId: hubSubscriptionId
resourceGroupName: hubResourceGroup.outputs.name
resourceGroupResourceId: hubResourceGroup.outputs.id
virtualNetworkName: hubNetwork.outputs.virtualNetworkName
virtualNetworkResourceId: hubNetwork.outputs.virtualNetworkResourceId
subnetName: hubNetwork.outputs.subnetName
subnetResourceId: hubNetwork.outputs.subnetResourceId
subnetAddressPrefix: hubNetwork.outputs.subnetAddressPrefix
networkSecurityGroupName: hubNetwork.outputs.networkSecurityGroupName
networkSecurityGroupResourceId: hubNetwork.outputs.networkSecurityGroupResourceId
}
output logAnalyticsWorkspaceName string = logAnalyticsWorkspace.outputs.name
output logAnalyticsWorkspaceResourceId string = logAnalyticsWorkspace.outputs.id
output spokes array = [for (spoke, i) in spokes: {
name: spoke.name
subscriptionId: spoke.subscriptionId
resourceGroupName: spokeResourceGroups[i].outputs.name
resourceGroupId: spokeResourceGroups[i].outputs.id
virtualNetworkName: spokeNetworks[i].outputs.virtualNetworkName
virtualNetworkResourceId: spokeNetworks[i].outputs.virtualNetworkResourceId
subnetName: spokeNetworks[i].outputs.subnetName
subnetResourceId: spokeNetworks[i].outputs.subnetResourceId
subnetAddressPrefix: spokeNetworks[i].outputs.subnetAddressPrefix
networkSecurityGroupName: spokeNetworks[i].outputs.networkSecurityGroupName
networkSecurityGroupResourceId: spokeNetworks[i].outputs.networkSecurityGroupResourceId
}]