Fix Optional diagnostic settings for Synapse SQL Pool (#104)

* optional synapse sql pool

* optional diagnostic settings

Co-authored-by: Marvin Buss <34542414+marvinbuss@users.noreply.github.com>
Co-authored-by: Marvin Buss <marvin.buss@gmail.com>
This commit is contained in:
Sushant Divate 2022-11-22 02:39:17 -08:00 коммит произвёл GitHub
Родитель d177917589
Коммит cf9095dfe0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 16 добавлений и 7 удалений

Просмотреть файл

@ -299,11 +299,11 @@ module diagnosticSettings './modules/services/diagnosticsettings.bicep' = if (en
params: { params: {
logAnalyticsName: enableMonitoring ? logAnalytics001.outputs.logAnalyticsWorkspaceName: '' logAnalyticsName: enableMonitoring ? logAnalytics001.outputs.logAnalyticsWorkspaceName: ''
synapseName: synapse001Name synapseName: synapse001Name
synapseSqlPools: [ synapseSqlPools:[
synapse001.outputs.synapseSqlPool001Name enableSqlPool ? synapse001.outputs.synapseSqlPool001Name : null
] ]
synapseSparkPools: [ synapseSparkPools: [
synapse001.outputs.synapseBigDataPool001Name synapse001.outputs.synapseBigDataPool001Name
] ]
cosmosdbName: enableCosmos ? cosmosdb001.outputs.cosmosdbName : '' cosmosdbName: enableCosmos ? cosmosdb001.outputs.cosmosdbName : ''
iothubName: iothub001Name iothubName: iothub001Name
@ -313,6 +313,7 @@ module diagnosticSettings './modules/services/diagnosticsettings.bicep' = if (en
enableCosmos: enableCosmos enableCosmos: enableCosmos
enableStreamAnalytics: enableStreamAnalytics enableStreamAnalytics: enableStreamAnalytics
database001Name: enableSqlServer ? sql001.outputs.sqlserverDatabaseName : '' database001Name: enableSqlServer ? sql001.outputs.sqlserverDatabaseName : ''
enableSqlPool: enableSqlPool
} }
} }

Просмотреть файл

@ -5,7 +5,7 @@
"_generator": { "_generator": {
"name": "bicep", "name": "bicep",
"version": "0.12.40.16777", "version": "0.12.40.16777",
"templateHash": "1043826373370405115" "templateHash": "17358088311522229630"
} }
}, },
"parameters": { "parameters": {
@ -2886,7 +2886,7 @@
}, },
"synapseSqlPools": { "synapseSqlPools": {
"value": [ "value": [
"[reference(resourceId('Microsoft.Resources/deployments', 'synapse001'), '2020-10-01').outputs.synapseSqlPool001Name.value]" "[if(parameters('enableSqlPool'), reference(resourceId('Microsoft.Resources/deployments', 'synapse001'), '2020-10-01').outputs.synapseSqlPool001Name.value, null())]"
] ]
}, },
"synapseSparkPools": { "synapseSparkPools": {
@ -2917,6 +2917,9 @@
}, },
"database001Name": { "database001Name": {
"value": "[if(parameters('enableSqlServer'), reference(resourceId('Microsoft.Resources/deployments', 'sql001'), '2020-10-01').outputs.sqlserverDatabaseName.value, '')]" "value": "[if(parameters('enableSqlServer'), reference(resourceId('Microsoft.Resources/deployments', 'sql001'), '2020-10-01').outputs.sqlserverDatabaseName.value, '')]"
},
"enableSqlPool": {
"value": "[parameters('enableSqlPool')]"
} }
}, },
"template": { "template": {
@ -2926,7 +2929,7 @@
"_generator": { "_generator": {
"name": "bicep", "name": "bicep",
"version": "0.12.40.16777", "version": "0.12.40.16777",
"templateHash": "13269706606198490871" "templateHash": "13746696680236980375"
} }
}, },
"parameters": { "parameters": {
@ -2965,6 +2968,9 @@
}, },
"database001Name": { "database001Name": {
"type": "string" "type": "string"
},
"enableSqlPool": {
"type": "bool"
} }
}, },
"variables": { "variables": {
@ -3008,6 +3014,7 @@
} }
}, },
{ {
"condition": "[parameters('enableSqlPool')]",
"copy": { "copy": {
"name": "diagnosticSetting002", "name": "diagnosticSetting002",
"count": "[length(range(0, variables('synapseSqlPoolsCount')))]" "count": "[length(range(0, variables('synapseSqlPoolsCount')))]"

Просмотреть файл

@ -17,6 +17,7 @@ param synapseSparkPools array
param enableCosmos bool param enableCosmos bool
param enableStreamAnalytics bool param enableStreamAnalytics bool
param database001Name string param database001Name string
param enableSqlPool bool
//variables //variables
var synapseSqlPoolsCount = length(synapseSqlPools) var synapseSqlPoolsCount = length(synapseSqlPools)
@ -100,7 +101,7 @@ resource diagnosticSetting001 'Microsoft.Insights/diagnosticSettings@2021-05-01-
} }
} }
resource diagnosticSetting002 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [for i in range(0, synapseSqlPoolsCount): { resource diagnosticSetting002 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [for i in range(0, synapseSqlPoolsCount): if(enableSqlPool) {
scope: synapsesqlpool[i] scope: synapsesqlpool[i]
name: 'diagnostic-${synapseworkspace.name}-${synapsesqlpool[i].name}' name: 'diagnostic-${synapseworkspace.name}-${synapsesqlpool[i].name}'
properties: { properties: {