-
Notifications
You must be signed in to change notification settings - Fork 517
/
Copy pathlogging.bicep
716 lines (648 loc) · 27.2 KB
/
logging.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
metadata name = 'ALZ Bicep - Logging Module'
metadata description = 'ALZ Bicep Module used to set up Logging'
type lockType = {
@description('Optional. Specify the name of lock.')
name: string?
@description('Optional. The lock settings of the service.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')
@description('Optional. Notes about this lock.')
notes: string?
}
@sys.description('''Global Resource Lock Configuration used for all resources deployed in this module.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parGlobalResourceLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@sys.description('Log Analytics Workspace name.')
param parLogAnalyticsWorkspaceName string = 'alz-log-analytics'
@sys.description('Log Analytics region name - Ensure the regions selected is a supported mapping as per: https://docs.microsoft.com/azure/automation/how-to/region-mappings.')
param parLogAnalyticsWorkspaceLocation string = resourceGroup().location
@sys.description('VM Insights Data Collection Rule name for AMA integration.')
param parDataCollectionRuleVMInsightsName string = 'alz-ama-vmi-dcr'
@sys.description('''Resource Lock Configuration for VM Insights Data Collection Rule.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parDataCollectionRuleVMInsightsLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@sys.description('Change Tracking Data Collection Rule name for AMA integration.')
param parDataCollectionRuleChangeTrackingName string = 'alz-ama-ct-dcr'
@sys.description('''Resource Lock Configuration for Change Tracking Data Collection Rule.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parDataCollectionRuleChangeTrackingLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@sys.description('MDFC for SQL Data Collection Rule name for AMA integration.')
param parDataCollectionRuleMDFCSQLName string = 'alz-ama-mdfcsql-dcr'
@sys.description('''Resource Lock Configuration for MDFC Defender for SQL Data Collection Rule.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parDataCollectionRuleMDFCSQLLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@allowed([
'CapacityReservation'
'Free'
'LACluster'
'PerGB2018'
'PerNode'
'Premium'
'Standalone'
'Standard'
])
@sys.description('Log Analytics Workspace sku name.')
param parLogAnalyticsWorkspaceSkuName string = 'PerGB2018'
@allowed([
100
200
300
400
500
1000
2000
5000
])
@sys.description('Log Analytics Workspace Capacity Reservation Level. Only used if parLogAnalyticsWorkspaceSkuName is set to CapacityReservation.')
param parLogAnalyticsWorkspaceCapacityReservationLevel int = 100
@minValue(30)
@maxValue(730)
@sys.description('Number of days of log retention for Log Analytics Workspace.')
param parLogAnalyticsWorkspaceLogRetentionInDays int = 365
@sys.description('''Resource Lock Configuration for Log Analytics Workspace.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parLogAnalyticsWorkspaceLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@allowed([
'SecurityInsights'
])
@sys.description('Solutions that will be added to the Log Analytics Workspace.')
param parLogAnalyticsWorkspaceSolutions array = [
'SecurityInsights'
]
@sys.description('''Resource Lock Configuration for Log Analytics Workspace Solutions.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parLogAnalyticsWorkspaceSolutionsLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@sys.description('Name of the User Assigned Managed Identity required for authenticating Azure Monitoring Agent to Azure.')
param parUserAssignedManagedIdentityName string = 'alz-logging-mi'
@sys.description('User Assigned Managed Identity location.')
param parUserAssignedManagedIdentityLocation string = resourceGroup().location
@sys.description('Log Analytics Workspace should be linked with the automation account.')
param parLogAnalyticsWorkspaceLinkAutomationAccount bool = true
@sys.description('Automation account name.')
param parAutomationAccountName string = 'alz-automation-account'
@sys.description('Automation Account region name. - Ensure the regions selected is a supported mapping as per: https://docs.microsoft.com/azure/automation/how-to/region-mappings.')
param parAutomationAccountLocation string = resourceGroup().location
@sys.description('Automation Account - use managed identity.')
param parAutomationAccountUseManagedIdentity bool = true
@sys.description('Automation Account - Public network access.')
param parAutomationAccountPublicNetworkAccess bool = true
@sys.description('''Resource Lock Configuration for Automation Account.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
- `notes` - Notes about this lock.
''')
param parAutomationAccountLock lockType = {
kind: 'None'
notes: 'This lock was created by the ALZ Bicep Logging Module.'
}
@sys.description('Tags you would like to be applied to all resources in this module.')
param parTags object = {}
@sys.description('Tags you would like to be applied to Automation Account.')
param parAutomationAccountTags object = parTags
@sys.description('Tags you would like to be applied to Log Analytics Workspace.')
param parLogAnalyticsWorkspaceTags object = parTags
@sys.description('Set Parameter to true to use Sentinel Classic Pricing Tiers, following changes introduced in July 2023 as documented here: https://learn.microsoft.com/azure/sentinel/enroll-simplified-pricing-tier.')
param parUseSentinelClassicPricingTiers bool = false
@sys.description('Log Analytics LinkedService name for Automation Account.')
param parLogAnalyticsLinkedServiceAutomationAccountName string = 'Automation'
@sys.description('Set Parameter to true to Opt-out of deployment telemetry')
param parTelemetryOptOut bool = false
// Customer Usage Attribution Id
var varCuaid = 'f8087c67-cc41-46b2-994d-66e4b661860d'
resource resUserAssignedManagedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: parUserAssignedManagedIdentityName
location: parUserAssignedManagedIdentityLocation
tags: parTags
}
resource resAutomationAccount 'Microsoft.Automation/automationAccounts@2023-11-01' = {
name: parAutomationAccountName
location: parAutomationAccountLocation
tags: parAutomationAccountTags
identity: parAutomationAccountUseManagedIdentity ? {
type: 'SystemAssigned'
} : null
properties: {
encryption: {
keySource: 'Microsoft.Automation'
}
publicNetworkAccess: parAutomationAccountPublicNetworkAccess
sku: {
name: 'Basic'
}
}
}
// Create a resource lock for the automation account if parGlobalResourceLock.kind != 'None' or if parAutomationAccountLock.kind != 'None'
resource resAutomationAccountLock 'Microsoft.Authorization/locks@2020-05-01' = if (parAutomationAccountLock.kind != 'None' || parGlobalResourceLock.kind != 'None') {
scope: resAutomationAccount
name: parAutomationAccountLock.?name ?? '${resAutomationAccount.name}-lock'
properties: {
level: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.kind : parAutomationAccountLock.kind
notes: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.?notes : parAutomationAccountLock.?notes
}
}
resource resLogAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: parLogAnalyticsWorkspaceName
location: parLogAnalyticsWorkspaceLocation
tags: parLogAnalyticsWorkspaceTags
properties: {
sku: {
name: parLogAnalyticsWorkspaceSkuName
capacityReservationLevel: parLogAnalyticsWorkspaceSkuName == 'CapacityReservation' ? parLogAnalyticsWorkspaceCapacityReservationLevel : null
}
retentionInDays: parLogAnalyticsWorkspaceLogRetentionInDays
}
}
// Create a resource lock for the log analytics workspace if parGlobalResourceLock.kind != 'None' or if parLogAnalyticsWorkspaceLock.kind != 'None'
resource resLogAnalyticsWorkspaceLock 'Microsoft.Authorization/locks@2020-05-01' = if (parLogAnalyticsWorkspaceLock.kind != 'None' || parGlobalResourceLock.kind != 'None') {
scope: resLogAnalyticsWorkspace
name: parLogAnalyticsWorkspaceLock.?name ?? '${resLogAnalyticsWorkspace.name}-lock'
properties: {
level: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.kind : parLogAnalyticsWorkspaceLock.kind
notes: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.?notes : parLogAnalyticsWorkspaceLock.?notes
}
}
resource resDataCollectionRuleVMInsights 'Microsoft.Insights/dataCollectionRules@2021-04-01' = {
name: parDataCollectionRuleVMInsightsName
location: parLogAnalyticsWorkspaceLocation
tags: parTags
properties: {
description: 'Data collection rule for VM Insights'
dataSources: {
performanceCounters: [
{
name: 'VMInsightsPerfCounters'
streams: [
'Microsoft-InsightsMetrics'
]
counterSpecifiers: [
'\\VMInsights\\DetailedMetrics'
]
samplingFrequencyInSeconds: 60
}
]
extensions: [
{
streams: [
'Microsoft-ServiceMap'
]
extensionName: 'DependencyAgent'
extensionSettings: {}
name: 'DependencyAgentDataSource'
}
]
}
destinations: {
logAnalytics: [
{
workspaceResourceId: resLogAnalyticsWorkspace.id
name: 'VMInsightsPerf-Logs-Dest'
}
]
}
dataFlows: [
{
streams: [
'Microsoft-InsightsMetrics'
]
destinations: [
'VMInsightsPerf-Logs-Dest'
]
}
{
streams: [
'Microsoft-ServiceMap'
]
destinations: [
'VMInsightsPerf-Logs-Dest'
]
}
]
}
}
// Create a resource lock for the Data Collection Rule if parGlobalResourceLock.kind != 'None' or if parDataCollectionRuleVMInsightsLock.kind != 'None'
resource resDataCollectionRuleVMInsightsLock 'Microsoft.Authorization/locks@2020-05-01' = if (parDataCollectionRuleVMInsightsLock.kind != 'None' || parGlobalResourceLock.kind != 'None') {
scope: resDataCollectionRuleVMInsights
name: parDataCollectionRuleVMInsightsLock.?name ?? '${resDataCollectionRuleVMInsights.name}-lock'
properties: {
level: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.kind : parDataCollectionRuleVMInsightsLock.kind
notes: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.?notes : parDataCollectionRuleVMInsightsLock.?notes
}
}
resource resDataCollectionRuleChangeTracking 'Microsoft.Insights/dataCollectionRules@2021-04-01' = {
name: parDataCollectionRuleChangeTrackingName
location: parLogAnalyticsWorkspaceLocation
tags: parTags
properties: {
description: 'Data collection rule for CT.'
dataSources: {
extensions: [
{
streams: [
'Microsoft-ConfigurationChange'
'Microsoft-ConfigurationChangeV2'
'Microsoft-ConfigurationData'
]
extensionName: 'ChangeTracking-Windows'
extensionSettings: {
enableFiles: true
enableSoftware: true
enableRegistry: true
enableServices: true
enableInventory: true
registrySettings: {
registryCollectionFrequency: 3000
registryInfo: [
{
name: 'Registry_1'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\Scripts\\Startup'
valueName: ''
}
{
name: 'Registry_2'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\Scripts\\Shutdown'
valueName: ''
}
{
name: 'Registry_3'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run'
valueName: ''
}
{
name: 'Registry_4'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components'
valueName: ''
}
{
name: 'Registry_5'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Classes\\Directory\\ShellEx\\ContextMenuHandlers'
valueName: ''
}
{
name: 'Registry_6'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Classes\\Directory\\Background\\ShellEx\\ContextMenuHandlers'
valueName: ''
}
{
name: 'Registry_7'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Classes\\Directory\\Shellex\\CopyHookHandlers'
valueName: ''
}
{
name: 'Registry_8'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers'
valueName: ''
}
{
name: 'Registry_9'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers'
valueName: ''
}
{
name: 'Registry_10'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects'
valueName: ''
}
{
name: 'Registry_11'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects'
valueName: ''
}
{
name: 'Registry_12'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\Extensions'
valueName: ''
}
{
name: 'Registry_13'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Internet Explorer\\Extensions'
valueName: ''
}
{
name: 'Registry_14'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32'
valueName: ''
}
{
name: 'Registry_15'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32'
valueName: ''
}
{
name: 'Registry_16'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\KnownDlls'
valueName: ''
}
{
name: 'Registry_17'
groupTag: 'Recommended'
enabled: false
recurse: true
description: ''
keyName: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify'
valueName: ''
}
]
}
fileSettings: {
fileCollectionFrequency: 2700
}
softwareSettings: {
softwareCollectionFrequency: 1800
}
inventorySettings: {
inventoryCollectionFrequency: 36000
}
serviceSettings: {
serviceCollectionFrequency: 1800
}
}
name: 'CTDataSource-Windows'
}
{
streams: [
'Microsoft-ConfigurationChange'
'Microsoft-ConfigurationChangeV2'
'Microsoft-ConfigurationData'
]
extensionName: 'ChangeTracking-Linux'
extensionSettings: {
enableFiles: true
enableSoftware: true
enableRegistry: false
enableServices: true
enableInventory: true
fileSettings: {
fileCollectionFrequency: 900
fileInfo: [
{
name: 'ChangeTrackingLinuxPath_default'
enabled: true
destinationPath: '/etc/.*.conf'
useSudo: true
recurse: true
maxContentsReturnable: 5000000
pathType: 'File'
type: 'File'
links: 'Follow'
maxOutputSize: 500000
groupTag: 'Recommended'
}
]
}
softwareSettings: {
softwareCollectionFrequency: 300
}
inventorySettings: {
inventoryCollectionFrequency: 36000
}
serviceSettings: {
serviceCollectionFrequency: 300
}
}
name: 'CTDataSource-Linux'
}
]
}
destinations: {
logAnalytics: [
{
workspaceResourceId: resLogAnalyticsWorkspace.id
name: 'Microsoft-CT-Dest'
}
]
}
dataFlows: [
{
streams: [
'Microsoft-ConfigurationChange'
'Microsoft-ConfigurationChangeV2'
'Microsoft-ConfigurationData'
]
destinations: [
'Microsoft-CT-Dest'
]
}
]
}
}
// Create a resource lock for the Data Collection Rule if parGlobalResourceLock.kind != 'None' or if parDataCollectionRuleChangeTrackingLock.kind != 'None'
resource resDataCollectionRuleChangeTrackingLock 'Microsoft.Authorization/locks@2020-05-01' = if (parDataCollectionRuleChangeTrackingLock.kind != 'None' || parGlobalResourceLock.kind != 'None') {
scope: resDataCollectionRuleChangeTracking
name: parDataCollectionRuleChangeTrackingLock.?name ?? '${resDataCollectionRuleChangeTracking.name}-lock'
properties: {
level: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.kind : parDataCollectionRuleChangeTrackingLock.kind
notes: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.?notes : parDataCollectionRuleChangeTrackingLock.?notes
}
}
resource resDataCollectionRuleMDFCSQL'Microsoft.Insights/dataCollectionRules@2021-04-01' = {
name: parDataCollectionRuleMDFCSQLName
location: parLogAnalyticsWorkspaceLocation
tags: parTags
properties: {
description: 'Data collection rule for Defender for SQL.'
dataSources: {
extensions: [
{
extensionName: 'MicrosoftDefenderForSQL'
name: 'MicrosoftDefenderForSQL'
streams: [
'Microsoft-DefenderForSqlAlerts'
'Microsoft-DefenderForSqlLogins'
'Microsoft-DefenderForSqlTelemetry'
'Microsoft-DefenderForSqlScanEvents'
'Microsoft-DefenderForSqlScanResults'
'Microsoft-SqlAtpStatus-DefenderForSql'
]
extensionSettings: {
enableCollectionOfSqlQueriesForSecurityResearch: true
}
}
]
}
destinations: {
logAnalytics: [
{
workspaceResourceId: resLogAnalyticsWorkspace.id
name: 'Microsoft-DefenderForSQL-Dest'
}
]
}
dataFlows: [
{
streams: [
'Microsoft-DefenderForSqlAlerts'
'Microsoft-DefenderForSqlLogins'
'Microsoft-DefenderForSqlTelemetry'
'Microsoft-DefenderForSqlScanEvents'
'Microsoft-DefenderForSqlScanResults'
'Microsoft-SqlAtpStatus-DefenderForSql'
]
destinations: [
'Microsoft-DefenderForSQL-Dest'
]
}
]
}
}
// Create a resource lock for the Data Collection Rule if parGlobalResourceLock.kind != 'None' or if parDataCollectionRuleMDFCSQLLock.kind != 'None'
resource resDataCollectionRuleMDFCSQLLock 'Microsoft.Authorization/locks@2020-05-01' = if (parDataCollectionRuleMDFCSQLLock.kind != 'None' || parGlobalResourceLock.kind != 'None') {
scope: resDataCollectionRuleMDFCSQL
name: parDataCollectionRuleMDFCSQLLock.?name ?? '${resDataCollectionRuleMDFCSQL.name}-lock'
properties: {
level: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.kind : parDataCollectionRuleMDFCSQLLock.kind
notes: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.?notes : parDataCollectionRuleMDFCSQLLock.?notes
}
}
// Onboard the Log Analytics Workspace to Sentinel if SecurityInsights is in parLogAnalyticsWorkspaceSolutions
resource resSentinelOnboarding 'Microsoft.SecurityInsights/onboardingStates@2024-03-01' = if (contains(parLogAnalyticsWorkspaceSolutions, 'SecurityInsights')) {
name: 'default'
scope: resLogAnalyticsWorkspace
properties: {}
}
resource resLogAnalyticsWorkspaceSolutions 'Microsoft.OperationsManagement/solutions@2015-11-01-preview' = [for solution in parLogAnalyticsWorkspaceSolutions: {
name: '${solution}(${resLogAnalyticsWorkspace.name})'
location: parLogAnalyticsWorkspaceLocation
tags: parTags
properties: solution == 'SecurityInsights' ? {
workspaceResourceId: resLogAnalyticsWorkspace.id
sku: parUseSentinelClassicPricingTiers ? null : {
name: 'Unified'
}
} : {
workspaceResourceId: resLogAnalyticsWorkspace.id
}
plan: {
name: '${solution}(${resLogAnalyticsWorkspace.name})'
product: 'OMSGallery/${solution}'
publisher: 'Microsoft'
promotionCode: ''
}
}]
// Create a resource lock for each log analytics workspace solutions in parLogAnalyticsWorkspaceSolutions if parGlobalResourceLock.kind != 'None' or if parLogAnalyticsWorkspaceSolutionsLock.kind != 'None'
resource resLogAnalyticsWorkspaceSolutionsLock 'Microsoft.Authorization/locks@2020-05-01' = [for (solution, index) in parLogAnalyticsWorkspaceSolutions: if (parLogAnalyticsWorkspaceSolutionsLock.kind != 'None' || parGlobalResourceLock.kind != 'None') {
scope: resLogAnalyticsWorkspaceSolutions[index]
name: parLogAnalyticsWorkspaceSolutionsLock.?name ?? '${resLogAnalyticsWorkspaceSolutions[index].name}-lock'
properties: {
level: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.kind : parLogAnalyticsWorkspaceSolutionsLock.kind
notes: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock.?notes : parLogAnalyticsWorkspaceSolutionsLock.?notes
}
}]
resource resLogAnalyticsLinkedServiceForAutomationAccount 'Microsoft.OperationalInsights/workspaces/linkedServices@2020-08-01' = if (parLogAnalyticsWorkspaceLinkAutomationAccount) {
parent: resLogAnalyticsWorkspace
name: parLogAnalyticsLinkedServiceAutomationAccountName
properties: {
resourceId: resAutomationAccount.id
}
}
// Optional Deployment for Customer Usage Attribution
module modCustomerUsageAttribution '../../CRML/customerUsageAttribution/cuaIdResourceGroup.bicep' = if (!parTelemetryOptOut) {
#disable-next-line no-loc-expr-outside-params //Only to ensure telemetry data is stored in same location as deployment. See https://github.com/Azure/ALZ-Bicep/wiki/FAQ#why-are-some-linter-rules-disabled-via-the-disable-next-line-bicep-function for more information
name: 'pid-${varCuaid}-${uniqueString(resourceGroup().location)}'
params: {}
}
output outUserAssignedManagedIdentityId string = resUserAssignedManagedIdentity.id
output outUserAssignedManagedIdentityPrincipalId string = resUserAssignedManagedIdentity.properties.principalId
output outDataCollectionRuleVMInsightsName string = resDataCollectionRuleVMInsights.name
output outDataCollectionRuleVMInsightsId string = resDataCollectionRuleVMInsights.id
output outDataCollectionRuleChangeTrackingName string = resDataCollectionRuleChangeTracking.name
output outDataCollectionRuleChangeTrackingId string = resDataCollectionRuleChangeTracking.id
output outDataCollectionRuleMDFCSQLName string = resDataCollectionRuleMDFCSQL.name
output outDataCollectionRuleMDFCSQLId string = resDataCollectionRuleMDFCSQL.id
output outLogAnalyticsWorkspaceName string = resLogAnalyticsWorkspace.name
output outLogAnalyticsWorkspaceId string = resLogAnalyticsWorkspace.id
output outLogAnalyticsCustomerId string = resLogAnalyticsWorkspace.properties.customerId
output outLogAnalyticsSolutions array = parLogAnalyticsWorkspaceSolutions
output outAutomationAccountName string = resAutomationAccount.name
output outAutomationAccountId string = resAutomationAccount.id