-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKeyVault.json
328 lines (328 loc) · 9.07 KB
/
KeyVault.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
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
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"basename": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Base name for the Key Vault and Storage Account"
}
},
"accessPolicies": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "Access policies object {\"tenantId\":\"\",\"objectId\":\"\",\"permissions\":{\"keys\":[\"\"],\"secrets\":[\"\"]}}"
}
},
"logsRetentionInDays": {
"type": "int",
"defaultValue": 0,
"minValue": 0,
"maxValue": 365,
"metadata": {
"description": "Specifies the number of days that logs are gonna be kept. If you do not want to apply any retention policy and retain data forever, set value to 0."
}
},
"enableVaultForDeployment": {
"type": "bool",
"defaultValue": true,
"allowedValues": [
true,
false
],
"metadata": {
"description": "Specifies if the vault is enabled for deployment by script or compute (VM, Service Fabric, ...)"
}
},
"enableVaultForTemplateDeployment": {
"type": "bool",
"defaultValue": true,
"allowedValues": [
true,
false
],
"metadata": {
"description": "Specifies if the vault is enabled for a template deployment"
}
},
"enableVaultForDiskEncryption": {
"type": "bool",
"defaultValue": true,
"allowedValues": [
true,
false
],
"metadata": {
"description": "Specifies if the azure platform has access to the vault for enabling disk encryption scenarios."
}
},
"vaultSku": {
"type": "string",
"defaultValue": "Premium",
"allowedValues": [
"Standard",
"Premium"
],
"metadata": {
"description": "Specifies the SKU for the vault"
}
},
"preventDeletion": {
"type": "string",
"allowedValues": [
"Yes",
"No"
],
"defaultValue": "Yes"
},
"storageResourceGroup": {
"type": "string",
"metadata": {
"description": "Specifies the Storage Resource Group"
}
}
},
"variables": {
"locationAcronym": "[variables('locationLUT')[resourceGroup().location].acronym]",
"location": "[variables('locationLUT')[resourceGroup().location].name]",
"locationLUT": {
"usgovvirginia": {
"name": "USGov Virginia",
"acronym": "USGV"
},
"usgoviowa": {
"name": "USGov Iowa",
"acronym": "USGI"
},
"usdodeast": {
"name": "USDoD East",
"acronym": "USDE"
},
"usdodcentral": {
"name": "USDoD Central",
"acronym": "USDC"
},
"usgovtexas": {
"name": "USGov Texas",
"acronym": "USGT"
},
"usgovarizona": {
"name": "USGov Arizona",
"acronym": "USGA"
},
"eastasia": {
"name": "East Asia",
"acronym": "EA"
},
"southeastasia": {
"name": "Southeast Asia",
"acronym": "SEA"
},
"centralus": {
"name": "Central US",
"acronym": "CUS"
},
"eastus": {
"name": "East US",
"acronym": "EUS"
},
"eastus2": {
"name": "East US 2",
"acronym": "EUS2"
},
"westus": {
"name": "West US",
"acronym": "WUS"
},
"northcentralus": {
"name": "North Central US",
"acronym": "NCUS"
},
"southcentralus": {
"name": "South Central US",
"acronym": "SCUS"
},
"northeurope": {
"name": "North Europe",
"acronym": "NEU"
},
"westeurope": {
"name": "West Europe",
"acronym": "WEU"
},
"japanwest": {
"name": "Japan West",
"acronym": "JW"
},
"japaneast": {
"name": "Japan East",
"acronym": "JE"
},
"brazilsouth": {
"name": "Brazil South",
"acronym": "BZS"
},
"australiaeast": {
"name": "Australia East",
"acronym": "AUE"
},
"australiasoutheast": {
"name": "Australia Southeast",
"acronym": "AUSE"
},
"southindia": {
"name": "South India",
"acronym": "SI"
},
"centralindia": {
"name": "Central India",
"acronym": "CI"
},
"westindia": {
"name": "West India",
"acronym": "WI"
},
"canadacentral": {
"name": "Canada Central",
"acronym": "CC"
},
"canadaeast": {
"name": "Canada East",
"acronym": "CE"
},
"uksouth": {
"name": "UK South",
"acronym": "UKS"
},
"ukwest": {
"name": "UK West",
"acronym": "UKW"
},
"westcentralus": {
"name": "West Central US",
"acronym": "WCUS"
},
"westus2": {
"name": "West US 2",
"acronym": "WUS2"
},
"koreacentral": {
"name": "Korea Central",
"acronym": "KC"
},
"koreasouth": {
"name": "Korea South",
"acronym": "KS"
}
},
"keyVaultName": "[toUpper(concat('KV', parameters('basename')))]",
"diagnosticStorageAccountName": "[toLower(replace(concat('sa', variables('keyVaultName'), 'diag'), '-', ''))]"
},
"resources": [
{
"apiVersion": "2017-05-10",
"name": "diagnosticsStorage",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('storageResourceGroup')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('diagnosticStorageAccountName')]",
"apiVersion": "2017-10-01",
"location": "[variables('location')]",
"sku": {
"name": "Standard_GRS"
},
"kind": "Storage",
"properties": {}
},
{
"condition": "[equals(parameters('preventDeletion'), 'Yes')]",
"comments": "Resource lock on diagnostics storage account",
"type": "Microsoft.Storage/storageAccounts/providers/locks",
"name": "[concat(variables('diagnosticStorageAccountName'), '/Microsoft.Authorization/PreventDeletion')]",
"apiVersion": "2016-09-01",
"properties": {
"level": "CannotDelete"
},
"dependsOn": [
"[variables('diagnosticStorageAccountName')]"
]
}
]
}
}
},
{
"type": "Microsoft.KeyVault/vaults",
"name": "[variables('keyVaultName')]",
"apiVersion": "2016-10-01",
"location": "[variables('location')]",
"properties": {
"enabledForDeployment": "[parameters('enableVaultForDeployment')]",
"enabledForTemplateDeployment": "[parameters('enableVaultForTemplateDeployment')]",
"enabledForDiskEncryption": "[parameters('enableVaultForDiskEncryption')]",
"tenantId": "[subscription().tenantId]",
"accessPolicies": "[parameters('AccessPolicies')]",
"sku": {
"name": "[parameters('vaultSku')]",
"family": "A"
}
}
},
{
"type": "Microsoft.KeyVault/vaults/providers/diagnosticsettings",
"name": "[concat(variables('keyVaultName'), '/Microsoft.Insights/service')]",
"apiVersion": "2016-09-01",
"location": "[variables('location')]",
"properties": {
"storageAccountId": "[resourceId(parameters('storageResourceGroup'), 'Microsoft.Storage/storageAccounts', variables('diagnosticStorageAccountName'))]",
"logs": [
{
"category": "AuditEvent",
"enabled": true,
"retentionPolicy": {
"enabled": true,
"days": "[parameters('LogsRetentionInDays')]"
}
}
],
"metrics": [
{
"category": "AllMetrics",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": "[parameters('LogsRetentionInDays')]"
}
}
]
},
"dependsOn": [
"[concat('Microsoft.KeyVault/vaults/', variables('keyVaultName'))]",
"diagnosticsStorage"
]
},
{
"condition": "[equals(parameters('preventDeletion'), 'Yes')]",
"comments": "Resource lock on Key Vault",
"type": "Microsoft.KeyVault/vaults/providers/locks",
"name": "[concat(variables('keyVaultName'), '/Microsoft.Authorization/PreventDeletion')]",
"apiVersion": "2016-09-01",
"properties": {
"level": "CannotDelete"
},
"dependsOn": [
"[concat('Microsoft.KeyVault/vaults/', variables('keyVaultName'))]"
]
}
],
"outputs": {}
}