-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWarehouse_ARM.json
221 lines (221 loc) · 8.68 KB
/
Warehouse_ARM.json
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
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.18.4.5664",
"templateHash": "5509309609574105364"
}
},
"parameters": {
"mssqlServerFirewallClientIpAddress": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Gets added to SQL server firewall if not null"
}
},
"environmentType": {
"type": "string",
"defaultValue": "Test",
"metadata": {
"description": "Defines the SKU on the storage and SQL server, where Test is the cheapest but slowest installation"
},
"allowedValues": [
"Test",
"Prod"
]
},
"mssqlServerName": {
"type": "string",
"defaultValue": "[format('SqlServer{0}-{1}', parameters('environmentType'), uniqueString(resourceGroup().id))]",
"metadata": {
"description": "The name of the SQL server. Standard name will be \"SqlServer-Test/Prod-3xahh4xyxllq\" (suffix is resourcegroups id). You can change the prefilled string to something easier to read like WarehouseServer, but the name, has to be globaly unique."
}
},
"mssqlServerUser": {
"type": "string",
"defaultValue": "Warehouse",
"metadata": {
"description": "The username to the SQL server. It is adviced to only use alpha-numeric characters"
}
},
"mssqlServerPassword": {
"type": "securestring",
"metadata": {
"description": "The password to the SQL server. At least 8 characters. Don't use non-alphanumeric characters - it can raise errors with backslash for instance."
},
"minLength": 8
},
"mssqlDatabaseName": {
"type": "string",
"defaultValue": "Warehouse",
"metadata": {
"description": "The name of the SQL database. You can change the prefilled name"
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"storageSkuName": "[if(equals(parameters('environmentType'), 'Prod'), 'Standard_GRS', 'Standard_LRS')]",
"databaseSku": "[if(equals(parameters('environmentType'), 'Prod'), createObject('name', 'Standard', 'tier', 'Standard'), createObject('name', 'Basic', 'tier', 'Basic'))]"
},
"resources": [
{
"type": "Microsoft.KeyVault/vaults",
"apiVersion": "2022-07-01",
"name": "[format('keyvault-{0}', uniqueString(resourceGroup().id))]",
"location": "[variables('location')]",
"properties": {
"enabledForTemplateDeployment": true,
"tenantId": "[tenant().tenantId]",
"accessPolicies": [],
"sku": {
"name": "standard",
"family": "A"
}
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[format('appstorage{0}', uniqueString(resourceGroup().id))]",
"location": "[variables('location')]",
"sku": {
"name": "[variables('storageSkuName')]"
},
"kind": "Storage"
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2019-09-01",
"name": "[format('{0}/{1}', format('keyvault-{0}', uniqueString(resourceGroup().id)), 'Secret--AppStorageConnectionString')]",
"properties": {
"value": "[format('DefaultEndpointsProtocol=https;AccountName={0};EndpointSuffix={1};AccountKey={2}', format('appstorage{0}', uniqueString(resourceGroup().id)), environment().suffixes.storage, listKeys(resourceId('Microsoft.Storage/storageAccounts', format('appstorage{0}', uniqueString(resourceGroup().id))), '2019-06-01').keys[0].value)]"
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', format('appstorage{0}', uniqueString(resourceGroup().id)))]",
"[resourceId('Microsoft.KeyVault/vaults', format('keyvault-{0}', uniqueString(resourceGroup().id)))]"
]
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[format('datalake{0}', uniqueString(resourceGroup().id))]",
"location": "[variables('location')]",
"sku": {
"name": "[variables('storageSkuName')]"
},
"kind": "StorageV2",
"properties": {
"isHnsEnabled": true,
"accessTier": "Hot"
}
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2019-09-01",
"name": "[format('{0}/{1}', format('keyvault-{0}', uniqueString(resourceGroup().id)), 'Secret--DataLakeConnectionString')]",
"properties": {
"value": "[format('DefaultEndpointsProtocol=https;AccountName={0};EndpointSuffix={1};AccountKey={2}', format('datalake{0}', uniqueString(resourceGroup().id)), environment().suffixes.storage, listKeys(resourceId('Microsoft.Storage/storageAccounts', format('datalake{0}', uniqueString(resourceGroup().id))), '2019-06-01').keys[0].value)]"
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', format('datalake{0}', uniqueString(resourceGroup().id)))]",
"[resourceId('Microsoft.KeyVault/vaults', format('keyvault-{0}', uniqueString(resourceGroup().id)))]"
]
},
{
"type": "Microsoft.Insights/components",
"apiVersion": "2020-02-02-preview",
"name": "applicationInsights",
"location": "[variables('location')]",
"kind": "web",
"properties": {
"Application_Type": "web",
"publicNetworkAccessForIngestion": "Enabled",
"publicNetworkAccessForQuery": "Enabled"
}
},
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2020-11-01-preview",
"name": "[parameters('mssqlServerName')]",
"location": "[variables('location')]",
"properties": {
"administratorLogin": "[parameters('mssqlServerUser')]",
"administratorLoginPassword": "[parameters('mssqlServerPassword')]",
"publicNetworkAccess": "Enabled"
}
},
{
"condition": "[not(empty(parameters('mssqlServerFirewallClientIpAddress')))]",
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2015-05-01-preview",
"name": "[format('{0}/{1}', parameters('mssqlServerName'), 'ClientIP')]",
"properties": {
"startIpAddress": "[parameters('mssqlServerFirewallClientIpAddress')]",
"endIpAddress": "[parameters('mssqlServerFirewallClientIpAddress')]"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('mssqlServerName'))]"
]
},
{
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2015-05-01-preview",
"name": "[format('{0}/{1}', parameters('mssqlServerName'), 'AllowAllWindowsAzureIps')]",
"properties": {
"endIpAddress": "0.0.0.0",
"startIpAddress": "0.0.0.0"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('mssqlServerName'))]"
]
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2020-11-01-preview",
"name": "[format('{0}/{1}', parameters('mssqlServerName'), parameters('mssqlDatabaseName'))]",
"location": "[variables('location')]",
"sku": "[variables('databaseSku')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('mssqlServerName'))]"
]
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2019-09-01",
"name": "[format('{0}/{1}', format('keyvault-{0}', uniqueString(resourceGroup().id)), 'Secret--MssqlConnectionString')]",
"properties": {
"value": "[format('Server=tcp:{0},1433;Initial Catalog={1};Persist Security Info=False;User ID={2};Password={3};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;', reference(resourceId('Microsoft.Sql/servers', parameters('mssqlServerName')), '2020-11-01-preview').fullyQualifiedDomainName, parameters('mssqlDatabaseName'), parameters('mssqlServerUser'), parameters('mssqlServerPassword'))]"
},
"dependsOn": [
"[resourceId('Microsoft.KeyVault/vaults', format('keyvault-{0}', uniqueString(resourceGroup().id)))]",
"[resourceId('Microsoft.Sql/servers', parameters('mssqlServerName'))]"
]
}
],
"outputs": {
"dataLakeName": {
"type": "string",
"value": "[format('datalake{0}', uniqueString(resourceGroup().id))]"
},
"appStorageName": {
"type": "string",
"value": "[format('appstorage{0}', uniqueString(resourceGroup().id))]"
},
"appInsightsName": {
"type": "string",
"value": "applicationInsights"
},
"sqlServerName": {
"type": "string",
"value": "[parameters('mssqlServerName')]"
},
"sqlDatabaseName": {
"type": "string",
"value": "[parameters('mssqlDatabaseName')]"
}
}
}