JSON compareHide
compare mode:
side-by-side
line-by-line
version left: 3.0.0 2.0.0 1.0.1 1.0.0
version right: 4.0.0 3.0.0 2.0.0 1.0.1 1.0.0
@@ -3,9 +3,9 @@
3
"policyType": "BuiltIn",
4
"mode": "Indexed",
5
"description": "Deploys the diagnostic settings for SQL Databases to stream resource logs to a Log Analytics workspace when any SQL Database which is missing this diagnostic settings is created or updated.",
6
"metadata": {
7
-
"version": "3.0.0",
8
"category": "SQL"
9
},
10
"parameters": {
11
"effect": {
@@ -332,13 +332,25 @@
332
"field": "Microsoft.Insights/diagnosticSettings/logs[*].enabled",
333
"equals": "[parameters('DeadlocksEnabled')]"
334
}
335
]
336
}
337
]
338
}
339
},
340
-
"equals": 9
341
},
342
{
343
"count": {
344
"field": "Microsoft.Insights/diagnosticSettings/metrics[*]",
@@ -505,8 +517,12 @@
505
},
506
{
507
"category": "Deadlocks",
508
"enabled": "[parameters('DeadlocksEnabled')]"
509
}
510
]
511
}
512
}
3
"policyType": "BuiltIn",
4
"mode": "Indexed",
5
"description": "Deploys the diagnostic settings for SQL Databases to stream resource logs to a Log Analytics workspace when any SQL Database which is missing this diagnostic settings is created or updated.",
6
"metadata": {
7
+
"version": "4 .0.0",
8
"category": "SQL"
9
},
10
"parameters": {
11
"effect": {
332
"field": "Microsoft.Insights/diagnosticSettings/logs[*].enabled",
333
"equals": "[parameters('DeadlocksEnabled')]"
334
}
335
]
336
+
},
337
+
{
338
+
"allOf": [
339
+
{
340
+
"field": "Microsoft.Insights/diagnosticSettings/logs[*].category",
341
+
"equals": "SQLSecurityAuditEvents"
342
+
},
343
+
{
344
+
"field": "Microsoft.Insights/diagnosticSettings/logs[*].enabled",
345
+
"equals": "[parameters('SQLSecurityAuditEventsEnabled')]"
346
+
}
347
+
]
348
}
349
]
350
}
351
},
352
+
"equals": 10
353
},
354
{
355
"count": {
356
"field": "Microsoft.Insights/diagnosticSettings/metrics[*]",
517
},
518
{
519
"category": "Deadlocks",
520
"enabled": "[parameters('DeadlocksEnabled')]"
521
+
},
522
+
{
523
+
"category": "SQLSecurityAuditEvents",
524
+
"enabled": "[parameters('SQLSecurityAuditEventsEnabled')]"
525
}
526
]
527
}
528
}
JSON
api-version=2021-06-01
Copy definition Copy definition 4 EPAC EPAC
{ 7 items displayName: "Deploy - Configure diagnostic settings for SQL Databases to Log Analytics workspace" , policyType: "BuiltIn" , mode: "Indexed" , description: "Deploys the diagnostic settings for SQL Databases to stream resource logs to a Log Analytics workspace when any SQL Database which is missing this diagnostic settings is created or updated." , metadata: { 2 items version: "4.0.0" , category: "SQL" } , parameters: { 16 items effect: { 4 items type: "String" , metadata: { 2 items displayName: "Effect" , description: "Enable or disable the execution of the policy" } , allowedValues: [ 2 items "DeployIfNotExists" , "Disabled" ] , defaultValue: "DeployIfNotExists" } , diagnosticsSettingNameToUse: { 3 items type: "String" , metadata: { 2 items displayName: "Setting name" , description: "Name of the diagnostic settings." } , defaultValue: "SQLDatabaseDiagnosticsLogsToWorkspace" } , logAnalytics: { 2 items type: "String" , metadata: { 4 items displayName: "Log Analytics workspace" , description: "Select the Log Analytics workspace from dropdown list" , strongType: "omsWorkspace" , assignPermissions: true } } , QueryStoreRuntimeStatisticsEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "QueryStoreRuntimeStatistics - Enabled" , description: "Whether to stream QueryStoreRuntimeStatistics logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , QueryStoreWaitStatisticsEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "QueryStoreWaitStatistics - Enabled" , description: "Whether to stream QueryStoreWaitStatistics logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , ErrorsEnabled: { 4 items } , DatabaseWaitStatisticsEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "DatabaseWaitStatistics - Enabled" , description: "Whether to stream DatabaseWaitStatistics logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , BlocksEnabled: { 4 items } , SQLInsightsEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "SQLInsights - Enabled" , description: "Whether to stream SQLInsights logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , SQLSecurityAuditEventsEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "SQLSecurityAuditEvents - Enabled" , description: "Whether to stream SQLSecurityAuditEvents logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , TimeoutsEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "Timeouts - Enabled" , description: "Whether to stream Timeouts logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , AutomaticTuningEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "AutomaticTuning - Enabled" , description: "Whether to stream AutomaticTuning logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , DeadlocksEnabled: { 4 items type: "String" , metadata: { 2 items displayName: "Deadlocks - Enabled" , description: "Whether to stream Deadlocks logs to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , Basic: { 4 items type: "String" , metadata: { 2 items displayName: "Basic (metric) - Enabled" , description: "Whether to stream Basic metrics to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , InstanceAndAppAdvanced: { 4 items type: "String" , metadata: { 2 items displayName: "InstanceAndAppAdvanced (metric) - Enabled" , description: "Whether to stream InstanceAndAppAdvanced metrics to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } , WorkloadManagement: { 4 items type: "String" , metadata: { 2 items displayName: "WorkloadManagement (metric) - Enabled" , description: "Whether to stream WorkloadManagement metrics to the Log Analytics workspace - True or False" } , allowedValues: [ 2 items ] , defaultValue: "True" } } , policyRule: { 2 items if: { 1 item } , then: { 2 items effect: "[parameters('effect')]" , details: { 4 items type: "Microsoft.Insights/diagnosticSettings" , roleDefinitionIds: [ 2 items ] , existenceCondition: { 1 item allOf: [ 3 items { 2 items field: "Microsoft.Insights/diagnosticSettings/workspaceId" , equals: "[parameters('logAnalytics')]" } , { 2 items count: { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*]" , where: { 1 item anyOf: [ 10 items { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "SQLInsights" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('SQLInsightsEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "AutomaticTuning" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('AutomaticTuningEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "QueryStoreRuntimeStatistics" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('QueryStoreRuntimeStatisticsEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "QueryStoreWaitStatistics" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('QueryStoreWaitStatisticsEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "Errors" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('ErrorsEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "DatabaseWaitStatistics" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('DatabaseWaitStatisticsEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "Timeouts" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('TimeoutsEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "Blocks" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('BlocksEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "Deadlocks" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('DeadlocksEnabled')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].category" , equals: "SQLSecurityAuditEvents" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/logs[*].enabled" , equals: "[parameters('SQLSecurityAuditEventsEnabled')]" } ] } ] } } , equals: 10 } , { 2 items count: { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*]" , where: { 1 item anyOf: [ 3 items { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*].category" , equals: "Basic" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*].enabled" , equals: "[parameters('Basic')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*].category" , equals: "InstanceAndAppAdvanced" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*].enabled" , equals: "[parameters('InstanceAndAppAdvanced')]" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*].category" , equals: "WorkloadManagement" } , { 2 items field: "Microsoft.Insights/diagnosticSettings/metrics[*].enabled" , equals: "[parameters('WorkloadManagement')]" } ] } ] } } , equals: 3 } ] } , deployment: { 1 item properties: { 3 items mode: "incremental" , template: { 6 items $schema: "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" , contentVersion: "1.0.0.0" , parameters: { 17 items diagnosticsSettingNameToUse: { 1 item } , resourceName: { 1 item } , logAnalytics: { 1 item } , location: { 1 item } , Basic: { 1 item } , InstanceAndAppAdvanced: { 1 item } , WorkloadManagement: { 1 item } , QueryStoreRuntimeStatisticsEnabled: { 1 item } , QueryStoreWaitStatisticsEnabled: { 1 item } , ErrorsEnabled: { 1 item } , DatabaseWaitStatisticsEnabled: { 1 item } , BlocksEnabled: { 1 item } , SQLInsightsEnabled: { 1 item } , SQLSecurityAuditEventsEnabled: { 1 item } , TimeoutsEnabled: { 1 item } , AutomaticTuningEnabled: { 1 item } , DeadlocksEnabled: { 1 item } } , variables : {} , resources: [ 1 item { 6 items type: "Microsoft.Sql/servers/databases/providers/diagnosticSettings" , apiVersion: "2017-05-01-preview" , name: 🔍 "[
concat(
parameters('resourceName'),
'/',
'Microsoft.Insights/',
parameters('diagnosticsSettingNameToUse')
)
]", location: "[parameters('location')]" , dependsOn : [] , properties: { 3 items workspaceId: "[parameters('logAnalytics')]" , metrics: [ 3 items { 2 items category: "Basic" , enabled: "[parameters('Basic')]" } , { 2 items category: "InstanceAndAppAdvanced" , enabled: "[parameters('InstanceAndAppAdvanced')]" } , { 2 items category: "WorkloadManagement" , enabled: "[parameters('WorkloadManagement')]" } ] , logs: [ 10 items { 2 items category: "SQLInsights" , enabled: "[parameters('SQLInsightsEnabled')]" } , { 2 items category: "AutomaticTuning" , enabled: "[parameters('AutomaticTuningEnabled')]" } , { 2 items category: "QueryStoreRuntimeStatistics" , enabled: "[parameters('QueryStoreRuntimeStatisticsEnabled')]" } , { 2 items category: "QueryStoreWaitStatistics" , enabled: "[parameters('QueryStoreWaitStatisticsEnabled')]" } , { 2 items category: "Errors" , enabled: "[parameters('ErrorsEnabled')]" } , { 2 items category: "DatabaseWaitStatistics" , enabled: "[parameters('DatabaseWaitStatisticsEnabled')]" } , { 2 items category: "Timeouts" , enabled: "[parameters('TimeoutsEnabled')]" } , { 2 items category: "Blocks" , enabled: "[parameters('BlocksEnabled')]" } , { 2 items category: "Deadlocks" , enabled: "[parameters('DeadlocksEnabled')]" } , { 2 items category: "SQLSecurityAuditEvents" , enabled: "[parameters('SQLSecurityAuditEventsEnabled')]" } ] } } ] , outputs : {} } , parameters: { 17 items Basic: { 1 item value: "[parameters('Basic')]" } , InstanceAndAppAdvanced: { 1 item value: "[parameters('InstanceAndAppAdvanced')]" } , diagnosticsSettingNameToUse: { 1 item value: "[parameters('diagnosticsSettingNameToUse')]" } , WorkloadManagement: { 1 item value: "[parameters('WorkloadManagement')]" } , logAnalytics: { 1 item value: "[parameters('logAnalytics')]" } , location: { 1 item value: "[field('location')]" } , resourceName: { 1 item value: "[field('fullName')]" } , QueryStoreRuntimeStatisticsEnabled: { 1 item value: "[parameters('QueryStoreRuntimeStatisticsEnabled')]" } , QueryStoreWaitStatisticsEnabled: { 1 item value: "[parameters('QueryStoreWaitStatisticsEnabled')]" } , ErrorsEnabled: { 1 item value: "[parameters('ErrorsEnabled')]" } , DatabaseWaitStatisticsEnabled: { 1 item value: "[parameters('DatabaseWaitStatisticsEnabled')]" } , BlocksEnabled: { 1 item value: "[parameters('BlocksEnabled')]" } , SQLInsightsEnabled: { 1 item value: "[parameters('SQLInsightsEnabled')]" } , SQLSecurityAuditEventsEnabled: { 1 item value: "[parameters('SQLSecurityAuditEventsEnabled')]" } , TimeoutsEnabled: { 1 item value: "[parameters('TimeoutsEnabled')]" } , AutomaticTuningEnabled: { 1 item value: "[parameters('AutomaticTuningEnabled')]" } , DeadlocksEnabled: { 1 item value: "[parameters('DeadlocksEnabled')]" } } } } } } } }