Make DNS Zone Optional in Modules (#57)

* Make DNS Zone Optional in Modules

* updated arm

* converted sql admin name to param

* updated main bicep

* updated default variable

* Upgrade Bicep Version
This commit is contained in:
Marvin Buss 2021-08-23 12:54:58 +02:00 коммит произвёл GitHub
Родитель 6f09b334f3
Коммит ed40a02136
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 145 добавлений и 90 удалений

Двоичные данные
docs/images/deploytoazuregrey.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.0 KiB

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

@ -63,19 +63,28 @@ var tagsDefault = {
Name: name
}
var tagsJoined = union(tagsDefault, tags)
var administratorUsername = 'SqlServerMainUser'
var synapseDefaultStorageAccountSubscriptionId = split(synapseDefaultStorageAccountFileSystemId, '/')[2]
var synapseDefaultStorageAccountResourceGroupName = split(synapseDefaultStorageAccountFileSystemId, '/')[4]
var streamanalyticsDefaultStorageAccountSubscriptionId = split(streamanalyticsDefaultStorageAccountFileSystemId, '/')[2]
var streamanalyticsDefaultStorageAccountResourceGroupName = split(streamanalyticsDefaultStorageAccountFileSystemId, '/')[4]
var streamanalyticsDefaultStorageAccountName = split(streamanalyticsDefaultStorageAccountFileSystemId, '/')[8]
var keyVault001Name = '${name}-vault001'
var synapse001Name = '${name}-synapse001'
var cosmosdb001Name = '${name}-cosmos001'
var sql001Name = '${name}-sqlserver001'
var iothub001Name = '${name}-iothub001'
var eventhubNamespace001Name = '${name}-eventhub001'
var streamanalytics001Name = '${name}-streamanalytics001'
var streamanalyticscluster001Name = '${name}-streamanalyticscluster001'
// Resources
module keyvault001 'modules/services/keyvault.bicep' = {
name: 'keyvault001'
module keyVault001 'modules/services/keyvault.bicep' = {
name: 'keyVault001'
scope: resourceGroup()
params: {
location: location
keyvaultName: '${name}-vault001'
keyvaultName: keyVault001Name
tags: tagsJoined
subnetId: subnetId
privateDnsZoneIdKeyVault: privateDnsZoneIdKeyVault
@ -87,9 +96,10 @@ module synapse001 'modules/services/synapse.bicep' = {
scope: resourceGroup()
params: {
location: location
synapseName: '${name}-synapse001'
synapseName: synapse001Name
tags: tagsJoined
subnetId: subnetId
administratorUsername: administratorUsername
administratorPassword: administratorPassword
synapseSqlAdminGroupName: ''
synapseSqlAdminGroupObjectID: ''
@ -115,7 +125,7 @@ module cosmosdb001 'modules/services/cosmosdb.bicep' = {
scope: resourceGroup()
params: {
location: location
cosmosdbName: '${name}-cosmos001'
cosmosdbName: cosmosdb001Name
tags: tagsJoined
subnetId: subnetId
privateDnsZoneIdCosmosdbSql: privateDnsZoneIdCosmosdbSql
@ -127,9 +137,10 @@ module sql001 'modules/services/sql.bicep' = {
scope: resourceGroup()
params: {
location: location
sqlserverName: '${name}-sqlserver001'
sqlserverName: sql001Name
tags: tagsJoined
subnetId: subnetId
administratorUsername: administratorUsername
administratorPassword: administratorPassword
privateDnsZoneIdSqlServer: privateDnsZoneIdSqlServer
sqlserverAdminGroupName: ''
@ -142,7 +153,7 @@ module iothub001 'modules/services/iothub.bicep' = {
scope: resourceGroup()
params: {
location: location
iothubName: '${name}-iothub001'
iothubName: iothub001Name
tags: tagsJoined
subnetId: subnetId
iothubSkuName: 'S1'
@ -159,7 +170,7 @@ module eventhubNamespace001 'modules/services/eventhubnamespace.bicep' = {
location: location
tags: tagsJoined
subnetId: subnetId
eventhubnamespaceName: '${name}-eventhub001'
eventhubnamespaceName: eventhubNamespace001Name
privateDnsZoneIdEventhubNamespace: privateDnsZoneIdEventhubNamespace
eventhubnamespaceMinThroughput: 1
eventhubnamespaceMaxThroughput: 1
@ -175,9 +186,9 @@ module streamanalytics001 'modules/services/streamanalytics.bicep' = {
eventhubNamespaceId: eventhubNamespace001.outputs.eventhubNamespaceId
sqlServerId: sql001.outputs.sqlserverId
storageAccountId: resourceId(streamanalyticsDefaultStorageAccountSubscriptionId, streamanalyticsDefaultStorageAccountResourceGroupName, 'Microsoft.Storage/storageAccounts', streamanalyticsDefaultStorageAccountName)
streamanalyticsclusterName: '${name}-streamanalyticscluster001'
streamanalyticsclusterName: streamanalyticscluster001Name
streamanalyticsclusterSkuCapacity: 36
streamanalyticsName: '${name}-streamanalytics001'
streamanalyticsName: streamanalytics001Name
streamanalyticsjobSkuCapacity: 1
}
}

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

@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "7543092959463601567"
"version": "0.4.613.9944",
"templateHash": "13021743013125166427"
}
},
"parameters": {
@ -140,17 +140,26 @@
"Name": "[variables('name')]"
},
"tagsJoined": "[union(variables('tagsDefault'), parameters('tags'))]",
"administratorUsername": "SqlServerMainUser",
"synapseDefaultStorageAccountSubscriptionId": "[split(parameters('synapseDefaultStorageAccountFileSystemId'), '/')[2]]",
"synapseDefaultStorageAccountResourceGroupName": "[split(parameters('synapseDefaultStorageAccountFileSystemId'), '/')[4]]",
"streamanalyticsDefaultStorageAccountSubscriptionId": "[split(parameters('streamanalyticsDefaultStorageAccountFileSystemId'), '/')[2]]",
"streamanalyticsDefaultStorageAccountResourceGroupName": "[split(parameters('streamanalyticsDefaultStorageAccountFileSystemId'), '/')[4]]",
"streamanalyticsDefaultStorageAccountName": "[split(parameters('streamanalyticsDefaultStorageAccountFileSystemId'), '/')[8]]"
"streamanalyticsDefaultStorageAccountName": "[split(parameters('streamanalyticsDefaultStorageAccountFileSystemId'), '/')[8]]",
"keyVault001Name": "[format('{0}-vault001', variables('name'))]",
"synapse001Name": "[format('{0}-synapse001', variables('name'))]",
"cosmosdb001Name": "[format('{0}-cosmos001', variables('name'))]",
"sql001Name": "[format('{0}-sqlserver001', variables('name'))]",
"iothub001Name": "[format('{0}-iothub001', variables('name'))]",
"eventhubNamespace001Name": "[format('{0}-eventhub001', variables('name'))]",
"streamanalytics001Name": "[format('{0}-streamanalytics001', variables('name'))]",
"streamanalyticscluster001Name": "[format('{0}-streamanalyticscluster001', variables('name'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2019-10-01",
"name": "keyvault001",
"name": "keyVault001",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
@ -161,7 +170,7 @@
"value": "[parameters('location')]"
},
"keyvaultName": {
"value": "[format('{0}-vault001', variables('name'))]"
"value": "[variables('keyVault001Name')]"
},
"tags": {
"value": "[variables('tagsJoined')]"
@ -179,8 +188,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "17396931380066691428"
"version": "0.4.613.9944",
"templateHash": "15339723277993214204"
}
},
"parameters": {
@ -197,7 +206,8 @@
"type": "string"
},
"privateDnsZoneIdKeyVault": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
@ -305,7 +315,7 @@
"value": "[parameters('location')]"
},
"synapseName": {
"value": "[format('{0}-synapse001', variables('name'))]"
"value": "[variables('synapse001Name')]"
},
"tags": {
"value": "[variables('tagsJoined')]"
@ -313,6 +323,9 @@
"subnetId": {
"value": "[parameters('subnetId')]"
},
"administratorUsername": {
"value": "[variables('administratorUsername')]"
},
"administratorPassword": {
"value": "[parameters('administratorPassword')]"
},
@ -344,8 +357,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "6797724573404244465"
"version": "0.4.613.9944",
"templateHash": "12236755477810815741"
}
},
"parameters": {
@ -361,29 +374,39 @@
"synapseName": {
"type": "string"
},
"administratorUsername": {
"type": "string",
"defaultValue": "SqlServerMainUser"
},
"administratorPassword": {
"type": "secureString"
},
"synapseSqlAdminGroupName": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"synapseSqlAdminGroupObjectID": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"synapseDefaultStorageAccountFileSystemId": {
"type": "string"
},
"synapseComputeSubnetId": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"privateDnsZoneIdSynapseSql": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"privateDnsZoneIdSynapseDev": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"purviewId": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
@ -420,7 +443,7 @@
"purviewConfiguration": {
"purviewResourceId": "[parameters('purviewId')]"
},
"sqlAdministratorLogin": "SqlServerMainUser",
"sqlAdministratorLogin": "[parameters('administratorUsername')]",
"sqlAdministratorLoginPassword": "[parameters('administratorPassword')]",
"virtualNetworkProfile": {
"computeSubnetId": "[parameters('synapseComputeSubnetId')]"
@ -490,7 +513,7 @@
]
},
{
"condition": "[and(not(equals(parameters('synapseSqlAdminGroupName'), '')), not(equals(parameters('synapseSqlAdminGroupObjectID'), '')))]",
"condition": "[and(not(empty(parameters('synapseSqlAdminGroupName'))), not(empty(parameters('synapseSqlAdminGroupObjectID'))))]",
"type": "Microsoft.Synapse/workspaces/administrators",
"apiVersion": "2021-03-01",
"name": "[format('{0}/{1}', parameters('synapseName'), 'activeDirectory')]",
@ -681,8 +704,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "5856561103668696973"
"version": "0.4.613.9944",
"templateHash": "16578949331457096017"
}
},
"parameters": {
@ -733,7 +756,7 @@
"value": "[parameters('location')]"
},
"cosmosdbName": {
"value": "[format('{0}-cosmos001', variables('name'))]"
"value": "[variables('cosmosdb001Name')]"
},
"tags": {
"value": "[variables('tagsJoined')]"
@ -751,8 +774,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "10723084503331442716"
"version": "0.4.613.9944",
"templateHash": "18128198747734631092"
}
},
"parameters": {
@ -769,7 +792,8 @@
"type": "string"
},
"privateDnsZoneIdCosmosdbSql": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
@ -885,7 +909,7 @@
"value": "[parameters('location')]"
},
"sqlserverName": {
"value": "[format('{0}-sqlserver001', variables('name'))]"
"value": "[variables('sql001Name')]"
},
"tags": {
"value": "[variables('tagsJoined')]"
@ -893,6 +917,9 @@
"subnetId": {
"value": "[parameters('subnetId')]"
},
"administratorUsername": {
"value": "[variables('administratorUsername')]"
},
"administratorPassword": {
"value": "[parameters('administratorPassword')]"
},
@ -912,8 +939,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "9454033103282016427"
"version": "0.4.613.9944",
"templateHash": "16942979409177871223"
}
},
"parameters": {
@ -929,22 +956,28 @@
"sqlserverName": {
"type": "string"
},
"administratorUsername": {
"type": "string",
"defaultValue": "SqlServerMainUser"
},
"administratorPassword": {
"type": "secureString"
},
"sqlserverAdminGroupName": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"sqlserverAdminGroupObjectID": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"privateDnsZoneIdSqlServer": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
"variables": {
"administratorUsername": "SqlServerMainUser",
"sqlserverPrivateEndpointName": "[format('{0}-private-endpoint', parameters('sqlserverName'))]"
},
"resources": [
@ -958,7 +991,7 @@
"type": "SystemAssigned"
},
"properties": {
"administratorLogin": "[variables('administratorUsername')]",
"administratorLogin": "[parameters('administratorUsername')]",
"administratorLoginPassword": "[parameters('administratorPassword')]",
"administrators": {},
"minimalTlsVersion": "1.2",
@ -967,7 +1000,7 @@
}
},
{
"condition": "[and(not(equals(parameters('sqlserverAdminGroupName'), '')), not(equals(parameters('sqlserverAdminGroupObjectID'), '')))]",
"condition": "[and(not(empty(parameters('sqlserverAdminGroupName'))), not(empty(parameters('sqlserverAdminGroupObjectID'))))]",
"type": "Microsoft.Sql/servers/administrators",
"apiVersion": "2020-11-01-preview",
"name": "[format('{0}/{1}', parameters('sqlserverName'), 'ActiveDirectory')]",
@ -1080,7 +1113,7 @@
"value": "[parameters('location')]"
},
"iothubName": {
"value": "[format('{0}-iothub001', variables('name'))]"
"value": "[variables('iothub001Name')]"
},
"tags": {
"value": "[variables('tagsJoined')]"
@ -1107,8 +1140,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "661057681506718586"
"version": "0.4.613.9944",
"templateHash": "8828750327145730280"
}
},
"parameters": {
@ -1125,17 +1158,21 @@
"type": "string"
},
"iothubSkuName": {
"type": "string"
"type": "string",
"defaultValue": "S1"
},
"iothubSkuCapacity": {
"type": "int",
"defaultValue": 1,
"minValue": 1
},
"privateDnsZoneIdIothub": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"privateDnsZoneIdEventhubNamespace": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
@ -1289,7 +1326,7 @@
"value": "[parameters('subnetId')]"
},
"eventhubnamespaceName": {
"value": "[format('{0}-eventhub001', variables('name'))]"
"value": "[variables('eventhubNamespace001Name')]"
},
"privateDnsZoneIdEventhubNamespace": {
"value": "[parameters('privateDnsZoneIdEventhubNamespace')]"
@ -1307,8 +1344,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "15619311822110692599"
"version": "0.4.613.9944",
"templateHash": "17934512854910693454"
}
},
"parameters": {
@ -1335,7 +1372,8 @@
"minValue": 1
},
"privateDnsZoneIdEventhubNamespace": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
@ -1447,13 +1485,13 @@
"value": "[resourceId(variables('streamanalyticsDefaultStorageAccountSubscriptionId'), variables('streamanalyticsDefaultStorageAccountResourceGroupName'), 'Microsoft.Storage/storageAccounts', variables('streamanalyticsDefaultStorageAccountName'))]"
},
"streamanalyticsclusterName": {
"value": "[format('{0}-streamanalyticscluster001', variables('name'))]"
"value": "[variables('streamanalyticscluster001Name')]"
},
"streamanalyticsclusterSkuCapacity": {
"value": 36
},
"streamanalyticsName": {
"value": "[format('{0}-streamanalytics001', variables('name'))]"
"value": "[variables('streamanalytics001Name')]"
},
"streamanalyticsjobSkuCapacity": {
"value": 1
@ -1465,8 +1503,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "16978930308717680943"
"version": "0.4.613.9944",
"templateHash": "16035487727448282155"
}
},
"parameters": {
@ -1484,11 +1522,13 @@
},
"streamanalyticsclusterSkuCapacity": {
"type": "int",
"defaultValue": 36,
"maxValue": 216,
"minValue": 36
},
"streamanalyticsjobSkuCapacity": {
"type": "int",
"defaultValue": 1,
"allowedValues": [
1,
3,
@ -1503,13 +1543,16 @@
]
},
"storageAccountId": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"sqlServerId": {
"type": "string"
"type": "string",
"defaultValue": ""
},
"eventhubNamespaceId": {
"type": "string"
"type": "string",
"defaultValue": ""
}
},
"functions": [],
@ -1683,8 +1726,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "5318036402076633462"
"version": "0.4.613.9944",
"templateHash": "15282887590249028112"
}
},
"parameters": {
@ -1732,8 +1775,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "10620586833079918916"
"version": "0.4.613.9944",
"templateHash": "65594353052544696"
}
},
"parameters": {

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

@ -9,7 +9,7 @@ param location string
param tags object
param subnetId string
param cosmosdbName string
param privateDnsZoneIdCosmosdbSql string
param privateDnsZoneIdCosmosdbSql string = ''
// Variables
var cosmosdbPrivateEndpointName = '${cosmosdb.name}-private-endpoint'

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

@ -15,7 +15,7 @@ param eventhubnamespaceMinThroughput int
@minValue(1)
@maxValue(20)
param eventhubnamespaceMaxThroughput int
param privateDnsZoneIdEventhubNamespace string
param privateDnsZoneIdEventhubNamespace string = ''
// Variables
var eventhubNamespacePrivateEndpointName = '${eventhubNamespace.name}-private-endpoint'

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

@ -9,11 +9,11 @@ param location string
param tags object
param subnetId string
param iothubName string
param iothubSkuName string
param iothubSkuName string = 'S1'
@minValue(1)
param iothubSkuCapacity int
param privateDnsZoneIdIothub string
param privateDnsZoneIdEventhubNamespace string
param iothubSkuCapacity int = 1
param privateDnsZoneIdIothub string = ''
param privateDnsZoneIdEventhubNamespace string = ''
// Variables
var iothubPrivateEndpointName = '${iothub.name}-private-endpoint'

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

@ -9,7 +9,7 @@ param location string
param tags object
param subnetId string
param keyvaultName string
param privateDnsZoneIdKeyVault string
param privateDnsZoneIdKeyVault string = ''
// Variables
var keyVaultPrivateEndpointName = '${keyVault.name}-private-endpoint'

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

@ -9,14 +9,14 @@ param location string
param tags object
param subnetId string
param sqlserverName string
param administratorUsername string = 'SqlServerMainUser'
@secure()
param administratorPassword string
param sqlserverAdminGroupName string
param sqlserverAdminGroupObjectID string
param privateDnsZoneIdSqlServer string
param sqlserverAdminGroupName string = ''
param sqlserverAdminGroupObjectID string = ''
param privateDnsZoneIdSqlServer string = ''
// Variables
var administratorUsername = 'SqlServerMainUser'
var sqlserverPrivateEndpointName = '${sqlserver.name}-private-endpoint'
// Resources
@ -37,7 +37,7 @@ resource sqlserver 'Microsoft.Sql/servers@2020-11-01-preview' = {
}
}
resource sqlserverAdministrators 'Microsoft.Sql/servers/administrators@2020-11-01-preview' = if (sqlserverAdminGroupName != '' && sqlserverAdminGroupObjectID != '') {
resource sqlserverAdministrators 'Microsoft.Sql/servers/administrators@2020-11-01-preview' = if (!empty(sqlserverAdminGroupName) && !empty(sqlserverAdminGroupObjectID)) {
parent: sqlserver
name: 'ActiveDirectory'
properties: {

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

@ -11,7 +11,7 @@ param streamanalyticsclusterName string
param streamanalyticsName string
@minValue(36)
@maxValue(216)
param streamanalyticsclusterSkuCapacity int
param streamanalyticsclusterSkuCapacity int = 36
@allowed([
1
3
@ -24,10 +24,10 @@ param streamanalyticsclusterSkuCapacity int
42
48
])
param streamanalyticsjobSkuCapacity int
param storageAccountId string
param sqlServerId string
param eventhubNamespaceId string
param streamanalyticsjobSkuCapacity int = 1
param storageAccountId string = ''
param sqlServerId string = ''
param eventhubNamespaceId string = ''
// Variables
var storageAccountName = length(split(storageAccountId, '/')) >= 9 ? last(split(storageAccountId, '/')) : 'incorrectSegmentLength'

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

@ -9,15 +9,16 @@ param location string
param tags object
param subnetId string
param synapseName string
param administratorUsername string = 'SqlServerMainUser'
@secure()
param administratorPassword string
param synapseSqlAdminGroupName string
param synapseSqlAdminGroupObjectID string
param synapseSqlAdminGroupName string = ''
param synapseSqlAdminGroupObjectID string = ''
param synapseDefaultStorageAccountFileSystemId string
param synapseComputeSubnetId string
param privateDnsZoneIdSynapseSql string
param privateDnsZoneIdSynapseDev string
param purviewId string
param synapseComputeSubnetId string = ''
param privateDnsZoneIdSynapseSql string = ''
param privateDnsZoneIdSynapseDev string = ''
param purviewId string = ''
// Variables
var synapseDefaultStorageAccountFileSystemName = length(split(synapseDefaultStorageAccountFileSystemId, '/')) >= 13 ? last(split(synapseDefaultStorageAccountFileSystemId, '/')) : 'incorrectSegmentLength'
@ -50,7 +51,7 @@ resource synapse 'Microsoft.Synapse/workspaces@2021-03-01' = {
purviewConfiguration: {
purviewResourceId: purviewId
}
sqlAdministratorLogin: 'SqlServerMainUser'
sqlAdministratorLogin: administratorUsername
sqlAdministratorLoginPassword: administratorPassword
virtualNetworkProfile: {
computeSubnetId: synapseComputeSubnetId
@ -121,7 +122,7 @@ resource synapseManagedIdentitySqlControlSettings 'Microsoft.Synapse/workspaces/
}
}
resource synapseAadAdministrators 'Microsoft.Synapse/workspaces/administrators@2021-03-01' = if (synapseSqlAdminGroupName != '' && synapseSqlAdminGroupObjectID != '') {
resource synapseAadAdministrators 'Microsoft.Synapse/workspaces/administrators@2021-03-01' = if (!empty(synapseSqlAdminGroupName)&& !empty(synapseSqlAdminGroupObjectID)) {
parent: synapse
name: 'activeDirectory'
properties: {