-
Notifications
You must be signed in to change notification settings - Fork 139
/
mlz.bicep
728 lines (610 loc) · 29.9 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
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
targetScope = 'subscription'
/*
NAMING CONVENTIONS
Here we define some naming conventions for resources.
First, take `resourcePrefix` and `resourceSuffix` by params.
Then, we use string interpolation to insert those values into a naming convention.
We were inspired for these abbreviations by: https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations
We were inspired for these naming conventions by: https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming
*/
var namingConvention = '${resourcePrefix}-resource_token-mlz_token-${resourceSuffix}'
var bastionHostNamingConvention = replace(namingConvention, 'resource_token', 'bas')
var firewallNamingConvention = replace(namingConvention, 'resource_token', 'afw')
var firewallPolicyNamingConvention = replace(namingConvention, 'resource_token', 'afwp')
var ipConfigurationNamingConvention = replace(namingConvention, 'resource_token', 'ipconf')
var logAnalyticsWorkspaceNamingConvention = replace(namingConvention, 'resource_token', 'log')
var networkInterfaceNamingConvention = replace(namingConvention, 'resource_token', 'nic')
var networkSecurityGroupNamingConvention = replace(namingConvention, 'resource_token', 'nsg')
var publicIpAddressNamingConvention = replace(namingConvention, 'resource_token', 'pip')
var resourceGroupNamingConvention = replace(namingConvention, 'resource_token', 'rg')
var storageAccountNamingConvention = '${resourcePrefix}stmlz_token${uniqueString(resourcePrefix, guid(nowUtc))}' // we use unique string here to generate uniqueness
var subnetNamingConvention = replace(namingConvention, 'resource_token', 'snet')
var virtualMachineNamingConvention = replace(namingConvention, 'resource_token', 'vm')
var virtualNetworkNamingConvention = replace(namingConvention, 'resource_token', 'vnet')
/*
CALCULATED VALUES
Here, we reference the naming conventions described above.
Then, use the replace() function to insert unique resource types and values into the naming convention.
*/
// HUB NAMES
var hubResourceGroupName = replace(resourceGroupNamingConvention, 'mlz_token', 'hub')
var hubLogStorageAccountName = replace(storageAccountNamingConvention, 'mlz_token', 'hub')
var hubVirtualNetworkName = replace(virtualNetworkNamingConvention, 'mlz_token', 'hub')
var hubNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, 'mlz_token', 'hub')
var hubSubnetName = replace(subnetNamingConvention, 'mlz_token', 'hub')
// IDENTITY NAMES
var identityResourceGroupName = replace(resourceGroupNamingConvention, 'mlz_token', 'identity')
var identityLogStorageAccountName = replace(storageAccountNamingConvention, 'mlz_token', 'id')
var identityVirtualNetworkName = replace(virtualNetworkNamingConvention, 'mlz_token', 'identity')
var identityNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, 'mlz_token', 'identity')
var identitySubnetName = replace(subnetNamingConvention, 'mlz_token', 'identity')
// OPERATIONS NAMES
var operationsResourceGroupName = replace(resourceGroupNamingConvention, 'mlz_token', 'operations')
var operationsLogStorageAccountName = replace(storageAccountNamingConvention, 'mlz_token', 'ops')
var operationsVirtualNetworkName = replace(virtualNetworkNamingConvention, 'mlz_token', 'operations')
var operationsNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, 'mlz_token', 'operations')
var operationsSubnetName = replace(subnetNamingConvention, 'mlz_token', 'operations')
// SHARED SERVICES NAMES
var sharedServicesResourceGroupName = replace(resourceGroupNamingConvention, 'mlz_token', 'sharedServices')
var sharedServicesLogStorageAccountName = replace(storageAccountNamingConvention, 'mlz_token', 'svcs')
var sharedServicesVirtualNetworkName = replace(virtualNetworkNamingConvention, 'mlz_token', 'sharedServices')
var sharedServicesNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, 'mlz_token', 'sharedServices')
var sharedServicesSubnetName = replace(subnetNamingConvention, 'mlz_token', 'sharedServices')
// LOG ANALYTICS NAMES
var logAnalyticsWorkspaceName = replace(logAnalyticsWorkspaceNamingConvention, 'mlz_token', 'operations')
// FIREWALL NAMES
var firewallName = replace(firewallNamingConvention, 'mlz_token', 'hub')
var firewallPolicyName = replace(firewallPolicyNamingConvention, 'mlz_token', 'hub')
var firewallClientIpConfigurationName = replace(ipConfigurationNamingConvention, 'mlz_token', 'afw-client')
var firewallClientPublicIPAddressName = replace(publicIpAddressNamingConvention, 'mlz_token', 'afw-client')
var firewallManagementIpConfigurationName = replace(ipConfigurationNamingConvention, 'mlz_token', 'afw-mgmt')
var firewallManagementPublicIPAddressName = replace(publicIpAddressNamingConvention, 'mlz_token', 'afw-mgmt')
// BASTION NAMES
var bastionHostName = replace(bastionHostNamingConvention, 'mlz_token', 'hub')
var bastionHostPublicIPAddressName = replace(publicIpAddressNamingConvention, 'mlz_token', 'bas')
var bastionHostIPConfigurationName = replace(ipConfigurationNamingConvention, 'mlz_token', 'bas')
var linuxNetworkInterfaceName = replace(networkInterfaceNamingConvention, 'mlz_token', 'bas-linux')
var linuxNetworkInterfaceIpConfigurationName = replace(ipConfigurationNamingConvention, 'mlz_token', 'bas-linux')
var linuxVmName = replace(virtualMachineNamingConvention, 'mlz_token', 'bas-linux')
var windowsNetworkInterfaceName = replace(networkInterfaceNamingConvention, 'mlz_token', 'bas-windows')
var windowsNetworkInterfaceIpConfigurationName = replace(ipConfigurationNamingConvention, 'mlz_token', 'bas-windows')
var windowsVmName = replace(virtualMachineNamingConvention, 'mlz_token', 'bas-windows')
// SPOKES
var spokes = [
{
name: 'identity'
subscriptionId: identitySubscriptionId
resourceGroupName: identityResourceGroupName
logStorageAccountName: identityLogStorageAccountName
virtualNetworkName: identityVirtualNetworkName
virtualNetworkAddressPrefix: identityVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: identityVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: identityVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: identityNetworkSecurityGroupName
networkSecurityGroupRules: identityNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: identityNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: identityNetworkSecurityGroupDiagnosticsMetrics
subnetName: identitySubnetName
subnetAddressPrefix: identitySubnetAddressPrefix
subnetServiceEndpoints: identitySubnetServiceEndpoints
}
{
name: 'operations'
subscriptionId: operationsSubscriptionId
resourceGroupName: operationsResourceGroupName
logStorageAccountName: operationsLogStorageAccountName
virtualNetworkName: operationsVirtualNetworkName
virtualNetworkAddressPrefix: operationsVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: operationsVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: operationsVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: operationsNetworkSecurityGroupName
networkSecurityGroupRules: operationsNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: operationsNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: operationsNetworkSecurityGroupDiagnosticsMetrics
subnetName: operationsSubnetName
subnetAddressPrefix: operationsSubnetAddressPrefix
subnetServiceEndpoints: operationsSubnetServiceEndpoints
}
{
name: 'sharedServices'
subscriptionId: sharedServicesSubscriptionId
resourceGroupName: sharedServicesResourceGroupName
logStorageAccountName: sharedServicesLogStorageAccountName
virtualNetworkName: sharedServicesVirtualNetworkName
virtualNetworkAddressPrefix: sharedServicesVirtualNetworkAddressPrefix
virtualNetworkDiagnosticsLogs: sharedServicesVirtualNetworkDiagnosticsLogs
virtualNetworkDiagnosticsMetrics: sharedServicesVirtualNetworkDiagnosticsMetrics
networkSecurityGroupName: sharedServicesNetworkSecurityGroupName
networkSecurityGroupRules: sharedServicesNetworkSecurityGroupRules
networkSecurityGroupDiagnosticsLogs: sharedServicesNetworkSecurityGroupDiagnosticsLogs
networkSecurityGroupDiagnosticsMetrics: sharedServicesNetworkSecurityGroupDiagnosticsMetrics
subnetName: sharedServicesSubnetName
subnetAddressPrefix: sharedServicesSubnetAddressPrefix
subnetServiceEndpoints: sharedServicesSubnetServiceEndpoints
}
]
/*
RESOURCES
Here, we create deployable resources.
*/
// RESOURCE GROUPS
module hubResourceGroup './modules/resourceGroup.bicep' = {
name: 'deploy-rg-hub-${nowUtc}'
scope: subscription(hubSubscriptionId)
params: {
name: hubResourceGroupName
location: location
tags: calculatedTags
}
}
module spokeResourceGroups './modules/resourceGroup.bicep' = [for spoke in spokes: {
name: 'deploy-rg-${spoke.name}-${nowUtc}'
scope: subscription(spoke.subscriptionId)
params: {
name: spoke.resourceGroupName
location: location
tags: calculatedTags
}
}]
// LOG ANALYTICS WORKSPACE
module logAnalyticsWorkspace './modules/logAnalyticsWorkspace.bicep' = {
name: 'deploy-laws-${nowUtc}'
scope: resourceGroup(operationsSubscriptionId, operationsResourceGroupName)
params: {
name: logAnalyticsWorkspaceName
location: location
tags: calculatedTags
deploySentinel: deploySentinel
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: location
tags: calculatedTags
logStorageAccountName: take(hubLogStorageAccountName, 23)
logStorageSkuName: logStorageSkuName
logAnalyticsWorkspaceName: logAnalyticsWorkspace.outputs.name
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
firewallIntrusionDetectionMode: firewallIntrusionDetectionMode
firewallDiagnosticsLogs: firewallDiagnosticsLogs
firewallDiagnosticsMetrics: firewallDiagnosticsMetrics
firewallClientIpConfigurationName: firewallClientIpConfigurationName
firewallClientSubnetName: 'AzureFirewallSubnet' // must be 'AzureFirewallSubnet'
firewallClientSubnetAddressPrefix: firewallClientSubnetAddressPrefix
firewallClientSubnetServiceEndpoints: firewallClientSubnetServiceEndpoints
firewallClientPublicIPAddressName: firewallClientPublicIPAddressName
firewallClientPublicIPAddressSkuName: firewallClientPublicIPAddressSkuName
firewallClientPublicIpAllocationMethod: firewallClientPublicIpAllocationMethod
firewallClientPublicIPAddressAvailabilityZones: firewallClientPublicIPAddressAvailabilityZones
firewallManagementIpConfigurationName: firewallManagementIpConfigurationName
firewallManagementSubnetName: 'AzureFirewallManagementSubnet' //this must be 'AzureFirewallManagementSubnet'
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: location
tags: calculatedTags
logStorageAccountName: string(take(spoke.logStorageAccountName, 23))
logStorageSkuName: 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 PEERINGS
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
}
}]
// 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
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
]
}]
module logAnalyticsDiagnosticLogging './modules/logAnalyticsDiagnosticLogging.bicep' = {
name: 'deploy-diagnostic-logging-${nowUtc}'
scope: resourceGroup(operationsSubscriptionId, operationsResourceGroupName)
params: {
diagnosticStorageAccountName: operationsLogStorageAccountName
logAnalyticsWorkspaceName: logAnalyticsWorkspace.outputs.name
}
dependsOn: [
hubNetwork
spokeNetworks
]
}
// SECURITY CENTER
module hubSecurityCenter './modules/securityCenter.bicep' = if(deployASC) {
name: 'set-hub-sub-security-center-${nowUtc}'
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: location
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
Here are all the parameters a user can override.
These are the mandatory parameters that Mission LZ does not provide a default for:
- resourcePrefix
*/
@minLength(3)
@maxLength(10)
@description('A prefix, 3-10 alphanumeric characters 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
@minLength(3)
@maxLength(6)
@description('A suffix, 3 to 6 characters in length, to append to resource names (e.g. "dev", "test", "prod", "mlz")')
param resourceSuffix string = 'mlz'
@description('The region to deploy resources into')
param location string = deployment().location
@description('The Storage Account SKU to use for log storage')
param logStorageSkuName string = 'Standard_GRS'
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 hubVirtualNetworkAddressPrefix string = '10.0.100.0/24'
param hubSubnetAddressPrefix string = '10.0.100.128/27'
param hubVirtualNetworkDiagnosticsLogs array = []
param hubVirtualNetworkDiagnosticsMetrics array = []
param hubNetworkSecurityGroupRules array = []
param hubNetworkSecurityGroupDiagnosticsLogs array = [
{
category: 'NetworkSecurityGroupEvent'
enabled: true
}
{
category: 'NetworkSecurityGroupRuleCounter'
enabled: true
}
]
param hubNetworkSecurityGroupDiagnosticsMetrics array = []
param hubSubnetServiceEndpoints array = [
{
service: 'Microsoft.Storage'
}
]
param firewallManagementSubnetAddressPrefix string = '10.0.100.64/26'
param firewallClientSubnetAddressPrefix string = '10.0.100.0/26'
@allowed([
'Alert'
'Deny'
'Off'
])
param firewallThreatIntelMode string = 'Alert'
@allowed([
'Alert'
'Deny'
'Off'
])
param firewallIntrusionDetectionMode string = 'Alert'
param firewallDiagnosticsLogs array = [
{
category: 'AzureFirewallApplicationRule'
enabled: true
}
{
category: 'AzureFirewallNetworkRule'
enabled: true
}
{
category: 'AzureFirewallDnsProxy'
enabled: true
}
]
param firewallDiagnosticsMetrics array = [
{
category: 'AllMetrics'
enabled: true
}
]
param firewallClientSubnetServiceEndpoints array = []
param firewallClientPublicIPAddressSkuName string = 'Standard'
param firewallClientPublicIpAllocationMethod string = 'Static'
param firewallClientPublicIPAddressAvailabilityZones array = []
param firewallManagementSubnetServiceEndpoints array = []
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 identityVirtualNetworkAddressPrefix string = '10.0.110.0/26'
param identityVirtualNetworkDiagnosticsLogs array = hubVirtualNetworkDiagnosticsLogs
param identityVirtualNetworkDiagnosticsMetrics array = hubVirtualNetworkDiagnosticsMetrics
param identityNetworkSecurityGroupRules array = hubNetworkSecurityGroupRules
param identityNetworkSecurityGroupDiagnosticsLogs array = hubNetworkSecurityGroupDiagnosticsLogs
param identityNetworkSecurityGroupDiagnosticsMetrics array = hubNetworkSecurityGroupDiagnosticsMetrics
param identitySubnetAddressPrefix string = '10.0.110.0/27'
param identitySubnetServiceEndpoints array = hubSubnetServiceEndpoints
param operationsVirtualNetworkAddressPrefix string = '10.0.115.0/26'
param operationsVirtualNetworkDiagnosticsLogs array = hubVirtualNetworkDiagnosticsLogs
param operationsVirtualNetworkDiagnosticsMetrics array = hubVirtualNetworkDiagnosticsMetrics
param operationsNetworkSecurityGroupRules array = hubNetworkSecurityGroupRules
param operationsNetworkSecurityGroupDiagnosticsLogs array = hubNetworkSecurityGroupDiagnosticsLogs
param operationsNetworkSecurityGroupDiagnosticsMetrics array = hubNetworkSecurityGroupDiagnosticsMetrics
param operationsSubnetAddressPrefix string = '10.0.115.0/27'
param operationsSubnetServiceEndpoints array = hubSubnetServiceEndpoints
param sharedServicesVirtualNetworkAddressPrefix string = '10.0.120.0/26'
param sharedServicesVirtualNetworkDiagnosticsLogs array = hubVirtualNetworkDiagnosticsLogs
param sharedServicesVirtualNetworkDiagnosticsMetrics array = hubVirtualNetworkDiagnosticsMetrics
param sharedServicesNetworkSecurityGroupRules array = hubNetworkSecurityGroupRules
param sharedServicesNetworkSecurityGroupDiagnosticsLogs array = hubNetworkSecurityGroupDiagnosticsLogs
param sharedServicesNetworkSecurityGroupDiagnosticsMetrics array = hubNetworkSecurityGroupDiagnosticsMetrics
param sharedServicesSubnetAddressPrefix string = '10.0.120.0/27'
param sharedServicesSubnetServiceEndpoints array = hubSubnetServiceEndpoints
param logAnalyticsWorkspaceCappingDailyQuotaGb int = -1
param logAnalyticsWorkspaceRetentionInDays int = 30
param logAnalyticsWorkspaceSkuName string = 'PerGB2018'
@description('When set to "True", enables Microsoft Sentinel within the MLZ Log Analytics workspace.')
param deploySentinel bool = false
@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 bastionHostSubnetAddressPrefix string = '10.0.100.160/27'
param bastionHostPublicIPAddressSkuName string = 'Standard'
param bastionHostPublicIPAddressAllocationMethod string = 'Static'
param bastionHostPublicIPAddressAvailabilityZones array = []
param linuxNetworkInterfacePrivateIPAddressAllocationMethod string = 'Dynamic'
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 windowsNetworkInterfacePrivateIPAddressAllocationMethod string = 'Dynamic'
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 = {}
var defaultTags = {
'resourcePrefix': resourcePrefix
'DeploymentType': 'MissionLandingZoneARM'
}
var calculatedTags = union(tags,defaultTags)
param nowUtc string = utcNow()
/*
OUTPUTS
Here, we emit objects to be used post-deployment.
A user can reference these outputs with the `az deployment sub show` command like this:
az deployment sub show --name <your deployment name> --query properties.outputs
With that output as JSON you could pass it as arguments to another deployment using the Shared Variable File Pattern:
https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/patterns-shared-variable-file
The output is a JSON object, you can use your favorite tool, like PowerShell or jq, to parse the values you need.
*/
output mlzResourcePrefix string = resourcePrefix
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
}]