-
Notifications
You must be signed in to change notification settings - Fork 1
/
tst-kvt.json
202 lines (202 loc) · 6.71 KB
/
tst-kvt.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
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"environmentName": {
"defaultValue": "oms",
"type": "String",
"metadata": {
"description": "Name for Azure database for PostgreSQL"
}
},
"environmentType": {
"type": "String",
"defaultValue": "tst",
"allowedValues": [
"dev",
"tst",
"uat",
"prd",
""
]
},
"appType": {
"type": "String",
"defaultValue": "pos",
"metadata": {
"description": "Provide the application type like pos."
}
},
"dbAdminPassword": {
"type": "secureString",
"defaultValue": "Winfo_123",
"metadata": {
"description": "Provide the PostgreSQL DB Admin Password to be stored in KV."
}
},
"rgName": {
"type": "String",
"defaultValue": "winfo-dev-rgp",
"metadata": {
"description": "Provide the application type like pos."
}
},
"keyVaultName": {
"type": "String",
"defaultValue": "tst-oms-psql-kvt",
"metadata": {
"description": "Provide the keyvault name where passwords required to be updated."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location of the resources"
}
},
"skuName": {
"type": "string",
"defaultValue": "standard",
"allowedValues": [
"standard",
"premium"
],
"metadata": {
"description": "The SKU of the vault to be created."
}
},
"keySize": {
"type": "int",
"defaultValue": 2048,
"metadata": {
"description": "The size in bits of the key to be created."
}
},
"ArrayDes": {
"type": "String",
"defaultValue": "gh_arm_deploy",
"metadata": {
"description": "Provide the container name where logs will be updated."
}
},
"repname": {
"type": "string",
"defaultValue": ""
},
"KeyVaultExists": {
"type": "bool"
}
},
"functions": [],
"variables": {
"deploymentName": "[concat(parameters('environmentType'),parameters('repname'),'-',parameters('environmentName'),'-db-kvt-',uniqueString(resourceGroup().id))]",
"adminSecretName": "[concat(parameters('environmentType'),parameters('repname'),'-',parameters('environmentName'),'-db-omsadmin-pw')]",
"dbconnectionStringName": "[concat(parameters('environmentType'),parameters('repname'),'-',parameters('environmentName'),'-db-connectionstring')]",
"dbconnectionStringvalue": "[concat('Host=',parameters('environmentType'),parameters('repname'),'-',parameters('environmentName'),'-psql.postgres.database.azure.com;Database=oms;Username=omsadmin;Password={0};Persist Security')]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "[variables('deploymentName')]",
"resourceGroup": "[parameters('rgName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {
},
"functions": [],
"resources": [
{
"type": "Microsoft.KeyVault/vaults",
"apiVersion": "2021-11-01-preview",
"name": "[parameters('keyVaultName')]",
"location": "[resourceGroup().location]",
"properties": {
"enabledForTemplateDeployment": true,
"enabledForDeployment": true,
"enableSoftDelete": true,
"softDeleteRetentionInDays": 90,
"tenantId": "[subscription().tenantId]",
"enabledForDiskEncryption": false,
"tags": {
"cost": "it",
"billto": "tgg",
"function": "[parameters('appType')]",
"teams": "[parameters('appType')]",
"environment": "[parameters('environmentType')]"
},
"sku": {
"name": "[parameters('skuName')]",
"family": "A"
},
"networkAcls": {
"defaultAction": "Allow",
"bypass": "AzureServices"
},
"vaultUri": "[concat('https://', parameters('keyVaultName'), '.vault.azure.net/')]",
"createMode": "[if(parameters('KeyVaultExists'),'recover', 'create')]",
"accessPolicies": [
{
"tenantId": "[subscription().tenantId]",
"objectId": "4e4c503a-c949-4ee2-a6b0-d40f57880681",
"permissions": {
"secrets": [
"Get",
"List",
"Set",
"Delete",
"Recover",
"Backup",
"Restore",
"Purge"
]
}
}
]
}
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2021-11-01-preview",
"name": "[format('{0}/{1}', parameters('keyVaultName'), variables('adminSecretName'))]",
"properties": {
"value": "[parameters('dbAdminPassword')]",
"keySize": "[parameters('keySize')]"
},
"copy": {
"count": 1,
"name": "adminSecret"
},
"dependsOn": [
"[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]"
]
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2021-11-01-preview",
"name": "[format('{0}/{1}', parameters('keyVaultName'), variables('dbconnectionStringName'))]",
"properties": {
"value": "[variables('dbconnectionStringvalue')]",
"keySize": "[parameters('keySize')]"
},
"dependsOn": [
"[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]","[resourceId('Microsoft.KeyVault/vaults/secrets', parameters('keyVaultName'), variables('adminSecretName'))]"
]
}
]
}
}
}
],
"outputs": {
"ARMOP": {
"type": "string",
"value": "[parameters('ArrayDes')]"
}
}
}