This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathazuredeploy.json
283 lines (283 loc) · 15.7 KB
/
azuredeploy.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
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.5.1",
"parameters": {
"functionAppName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create, this will also be used as the subdomain of your service endpoint (i.e. myapp.azurewebsites.net)."
}
},
"functionAppLanguage": {
"type": "string",
"allowedValues": [
"JavaScript",
"C#",
"C# Script (.csx)"
],
"metadata": {
"description": "The language to write your serverless functions in."
}
}
},
"variables": {
"functionAppNameLower": "[toLower(parameters('functionAppName'))]",
"documentDbName": "[concat('database', uniqueString(resourceGroup().id))]",
"storageAccountName": "[concat('storage', uniqueString(resourceGroup().id))]",
"notificationHubNamespace": "[concat('namespace', uniqueString(resourceGroup().id))]",
"notificationHubName": "[concat('hub', uniqueString(resourceGroup().id))]",
"keyVaultName": "[concat('keyvault', uniqueString(resourceGroup().id))]",
"functionAppUrl": "[concat(variables('functionAppNameLower'),'.azurewebsites.net')]",
"identityResourceId": "[concat(resourceId('Microsoft.Web/sites', variables('functionAppNameLower')),'/providers/Microsoft.ManagedIdentity/Identities/default')]",
"branch": "master",
"repoURL": "https://github.com/Azure/Azure.Mobile.git"
},
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"kind": "functionapp",
"name": "[variables('functionAppNameLower')]",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "[variables('functionAppNameLower')]",
"hostingEnvironment": ""
},
"sku": {
"name": "Y1",
"tier": "Dynamic"
}
},
{
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"name": "[variables('functionAppNameLower')]",
"apiVersion": "2016-08-01",
"location": "[resourceGroup().location]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"name": "[variables('functionAppNameLower')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('functionAppNameLower'))]",
"siteConfig": {
"phpVersion": "off",
"clientAffinityEnabled": false,
"hostingEnvironment": "",
"push": {
"isPushEnabled": true
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('functionAppNameLower'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.DocumentDb/databaseAccounts', variables('documentDbName'))]",
"[resourceId('Microsoft.NotificationHubs/namespaces', variables('notificationHubNamespace'))]",
"[resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs', variables('notificationHubNamespace'), variables('notificationHubName'))]"
],
"resources": [
{
"type": "config",
"name": "connectionstrings",
"apiVersion": "2016-08-01",
"properties": {
"MS_NotificationHubConnectionString": {
"value": "[listKeys(resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules', variables('notificationHubNamespace'), variables('notificationHubName'), 'DefaultFullSharedAccessSignature'), '2014-09-01').primaryConnectionString]",
"type": "NotificationHub"
},
"MS_AzureStorageAccountConnectionString": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2017-06-01').keys[0].value)]",
"type": "Custom"
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionAppNameLower'))]"
]
},
{
"type": "config",
"name": "appsettings",
"apiVersion": "2016-08-01",
"properties": {
"FUNCTION_APP_EDIT_MODE": "[if(equals(parameters('functionAppLanguage'),'C#'), 'readonly', 'readwrite')]",
"FUNCTIONS_EXTENSION_VERSION": "[if(equals(parameters('functionAppLanguage'),'C#'), 'beta', '~1')]",
"WEBSITE_AUTH_HIDE_DEPRECATED_SID": "true",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2017-06-01').keys[0].value)]",
"WEBSITE_CONTENTSHARE": "[variables('functionAppNameLower')]",
"WEBSITE_HTTPLOGGING_RETENTION_DAYS": "2",
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
"PROJECT": "[if(equals(parameters('functionAppLanguage'),'C#'), 'Server/csharp/csharp', if(equals(parameters('functionAppLanguage'),'JavaScript'), 'Server/javascript', 'Server/csharpscript'))]",
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2017-06-01').keys[0].value)]",
"AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2017-06-01').keys[0].value)]",
"AzureWebJobsDocumentDBConnectionString": "[concat('AccountEndpoint=', reference(concat('Microsoft.DocumentDb/databaseAccounts/', variables('documentDbName'))).documentEndpoint, ';AccountKey=', listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', variables('documentDbName')), '2015-04-08').primaryMasterKey)]",
"AzureWebJobsNotificationHubName": "[variables('notificationHubName')]",
"AzureWebJobsNotificationHubsConnectionString": "[listKeys(resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules', variables('notificationHubNamespace'), variables('notificationHubName'), 'DefaultFullSharedAccessSignature'), '2014-09-01').primaryConnectionString]",
"AzureWebJobsSecretStorageType": "Blob",
"RemoteDocumentDbKey": "[listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', variables('documentDbName')), '2015-04-08').primaryMasterKey]",
"RemoteDocumentDbUrl": "[reference(concat('Microsoft.DocumentDb/databaseAccounts/', variables('documentDbName'))).documentEndpoint]",
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', variables('functionAppNameLower')), '2015-05-01').InstrumentationKey]",
"MS_NotificationHubId": "[resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs', variables('notificationHubNamespace'), variables('notificationHubName'))]",
"MS_NotificationHubName": "[variables('notificationHubName')]",
"AzureKeyVaultName": "[variables('keyVaultName')]",
"AzureKeyVaultUrl": "[concat('https://', variables('keyVaultName'), '.vault.azure.net')]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionAppNameLower'))]"
]
},
{
"type": "sourcecontrols",
"name": "web",
"apiVersion": "2016-08-01",
"comments": "This section configures continuous deployment of the Function App from the GitHub repo.",
"properties": {
"repoUrl": "[variables('repoURL')]",
"branch": "[variables('branch')]",
"isManualIntegration": true
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('functionAppNameLower'))]",
"[resourceId('Microsoft.Web/sites', variables('functionAppNameLower'))]",
"[resourceId('Microsoft.Web/sites/config', variables('functionAppNameLower'), 'appsettings')]",
"[resourceId('Microsoft.Web/sites/config', variables('functionAppNameLower'), 'connectionstrings')]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.DocumentDb/databaseAccounts', variables('documentDbName'))]",
"[resourceId('Microsoft.NotificationHubs/namespaces', variables('notificationHubNamespace'))]",
"[resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs', variables('notificationHubNamespace'), variables('notificationHubName'))]",
"[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]",
"[resourceId('Microsoft.Insights/components', variables('functionAppNameLower'))]"
]
}
]
},
{
"type": "Microsoft.KeyVault/vaults",
"name": "[variables('keyVaultName')]",
"apiVersion": "2015-06-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {
"sku": {
"family": "A",
"name": "Standard"
},
"tenantId": "[reference(variables('identityResourceId'), '2015-08-31-PREVIEW').tenantId]",
"accessPolicies": [
{
"tenantId": "[reference(variables('identityResourceId'), '2015-08-31-PREVIEW').tenantId]",
"objectId": "[reference(variables('identityResourceId'), '2015-08-31-PREVIEW').principalId]",
"permissions": {
"secrets": [
"Get",
"List",
"Set",
"Delete"
]
}
}
],
"enabledForDeployment": false
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionAppNameLower'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('functionAppNameLower'))]"
]
},
{
"type": "Microsoft.Insights/components",
"kind": "web",
"name": "[variables('functionAppNameLower')]",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"properties": {
"ApplicationId": "[variables('functionAppNameLower')]"
},
"tags": {
"[concat('hidden-link:', resourceId('Microsoft.Web/sites', variables('functionAppNameLower')))]": "Resource"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionAppNameLower'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('functionAppNameLower'))]"
]
},
{
"type": "Microsoft.DocumentDB/databaseAccounts",
"name": "[variables('documentDbName')]",
"apiVersion": "2015-04-08",
"location": "[resourceGroup().location]",
"tags": {
"defaultExperience": "DocumentDB"
},
"properties": {
"name": "[variables('documentDbName')]",
"databaseAccountOfferType": "Standard",
"locations": [
{
"locationName": "[resourceGroup().location]",
"failoverPriority": 0
}
]
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "2017-06-01",
"kind": "Storage",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"name": "[variables('storageAccountName')]"
}
},
{
"type": "Microsoft.NotificationHubs/namespaces",
"name": "[variables('notificationHubNamespace')]",
"apiVersion": "2014-09-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "Free"
},
"properties": {
"name": "[variables('notificationHubNamespace')]",
"namespaceType": "NotificationHub"
},
"resources": [
{
"type": "Microsoft.NotificationHubs/namespaces/notificationHubs",
"name": "[concat(variables('notificationHubNamespace'), '/', variables('notificationHubName'))]",
"apiVersion": "2014-09-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "[variables('notificationHubName')]"
},
"dependsOn": [
"[resourceId('Microsoft.NotificationHubs/namespaces', variables('notificationHubNamespace'))]"
]
}
]
}
],
"outputs": {
"Configure_iOS": {
"type": "string",
"value": "[concat('AzureData.configure(forAccountNamed:\"', variables('documentDbName'), '\", withMasterKey: \"', listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', variables('documentDbName')), '2015-04-08').primaryMasterKey, '\", withPermissionMode: .all)')]"
},
"Configure_Android": {
"type": "string",
"value": "[concat('AzureData.configure(applicationContext, \"', variables('documentDbName'), '\", \"', listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', variables('documentDbName')), '2015-04-08').primaryMasterKey, '\", TokenType.MASTER)')]"
},
"FunctionsUrl": {
"type": "string",
"value": "[concat('https://',reference(resourceId('Microsoft.Web/sites', variables('functionAppNameLower'))).hostNames[0])]"
},
"DocumentDbUrl": {
"type": "string",
"value": "[reference(concat('Microsoft.DocumentDb/databaseAccounts/', variables('documentDbName'))).documentEndpoint]"
}
}
}