-
Notifications
You must be signed in to change notification settings - Fork 13
/
link_template.function_app.json
234 lines (234 loc) · 9.42 KB
/
link_template.function_app.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
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "3.6.0.0",
"parameters": {
"FunctionAppName": {
"type": "String"
},
"FunctionExtensionVersion": {
"type": "String",
"defaultValue": "~4"
},
"NodeJSRuntimeVersion": {
"type": "String",
"defaultValue": "~18"
},
"PackageResURL": {
"type": "String"
},
"ServicePlanTier": {
"defaultValue": "Premium (P1V2)",
"allowedValues": ["Premium (P1V2)", "Free (for demo only)"],
"type": "String"
},
"StorageAccountName": {
"type": "String"
},
"UniqueResourceNamePrefix": {
"type": "String"
}
},
"variables": {
"cmdDeleteAll": "[concat('az account set -s ', subscription().subscriptionId, ';', variables('cmdDeleteInsights'), variables('cmdDeleteSite'), variables('cmdDeleteServerFarm'))]",
"cmdDeleteInsights": "[if(variables('enableAzureAppInsights'), concat('az monitor app-insights component delete -g ', resourceGroup().name, ' -a ', parameters('FunctionAppName'), ';'), '')]",
"cmdDeleteServerFarm": "[concat('az appservice plan delete -y -g ', resourceGroup().name, ' -n ', variables('appServicePlanName'), ';')]",
"cmdDeleteSite": "[concat('az webapp delete -g ', resourceGroup().name, ' -n ', parameters('FunctionAppName'), ';')]",
"enableAzureAppInsights": "[contains(variables('functionAppInsightAvailableLocations'), resourceGroup().location)]",
"functionAppInsightAvailableLocations": [
"australiacentral",
"australiacentral2",
"australiaeast",
"australiaeast",
"australiasoutheast",
"brazilsouth",
"brazilsoutheast",
"canadacentral",
"canadaeast",
"centralindia",
"centralus",
"eastasia",
"eastus",
"eastus2",
"francecentral",
"francesouth",
"germanycentral",
"germanynorth",
"germanynortheast",
"germanywestcentral",
"japaneast",
"japanwest",
"koreacentral",
"koreasouth",
"northcentralus",
"northeurope",
"norwayeast",
"norwaywest",
"southafricanorth",
"southafricawest",
"southcentralus",
"southeastasia",
"southindia",
"swedencentral",
"swedensouth",
"switzerlandnorth",
"switzerlandwest",
"uaecentral",
"uaenorth",
"uksouth",
"ukwest",
"usgovarizona",
"usgovtexas",
"usgovvirginia",
"westcentralus",
"westeurope",
"westindia",
"westus",
"westus2",
"westus3"
],
"appInsightName": "[concat(parameters('UniqueResourceNamePrefix'),'-appins001')]",
"appServicePlanName": "[concat(parameters('UniqueResourceNamePrefix'),'-appserplan001')]",
"servicePlanTierPresets": {
"Free (for demo only)": {
"sku": "Free",
"skucode": "F1",
"workerSize": "0",
"workerSizeId": "0",
"numberOfWorkers": "1",
"reserved": false
},
"Premium (P1V2)": {
"sku": "PremiumV2",
"skucode": "P1v2",
"workerSize": "3",
"workerSizeId": "3",
"numberOfWorkers": "1",
"reserved": false
}
},
"storageAccountId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Storage/storageAccounts/', parameters('StorageAccountName'))]"
},
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[variables('appServicePlanName')]",
"location": "[resourceGroup().location]",
"sku": {
"Name": "[variables('servicePlanTierPresets')[parameters('ServicePlanTier')].skucode]"
},
"properties": {
"name": "[variables('appServicePlanName')]",
"workerSize": "[variables('servicePlanTierPresets')[parameters('ServicePlanTier')].workerSize]",
"numberOfWorkers": "[variables('servicePlanTierPresets')[parameters('ServicePlanTier')].numberOfWorkers]",
"reserved": "[variables('servicePlanTierPresets')[parameters('ServicePlanTier')].reserved]"
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('FunctionAppName')]",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": ["[variables('appServicePlanName')]"],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsSecretStorageType",
"value": "Blob"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('StorageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value)]"
},
{
"name": "[if(variables('enableAzureAppInsights'), 'APPINSIGHTS_INSTRUMENTATIONKEY', 'DEPLOYED_APPINSIGHTS')]",
"value": "[if(variables('enableAzureAppInsights'), reference(resourceId('Microsoft.Insights/components/', variables('appInsightName')), '2018-05-01-preview').InstrumentationKey, 'false')]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "[parameters('FunctionExtensionVersion')]"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "node"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('StorageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower(parameters('FunctionAppName'))]"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "[parameters('NodeJSRuntimeVersion')]"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "[parameters('PackageResURL')]"
}
]
},
"alwaysOn": true
}
},
{
"type": "Microsoft.Insights/components",
"apiVersion": "2018-05-01-preview",
"name": "[variables('appInsightName')]",
"location": "[resourceGroup().location]",
"kind": "web",
"properties": {
"Application_Type": "web",
"ApplicationId": "[parameters('FunctionAppName')]"
},
"condition": "[variables('enableAzureAppInsights')]"
}
],
"outputs": {
"appInsightName": {
"type": "String",
"value": "[if(variables('enableAzureAppInsights'), variables('appInsightName'), '')]"
},
"appServicePlanName": {
"type": "String",
"value": "[variables('appServicePlanName')]"
},
"cmdDeleteAll": {
"type": "String",
"value": "[variables('cmdDeleteAll')]"
},
"enableAzureAppInsights": {
"type": "String",
"value": "[if(variables('enableAzureAppInsights'), 'true', 'false')]"
},
"functionAppId": {
"type": "String",
"value": "[resourceId('Microsoft.Web/sites', parameters('FunctionAppName'))]"
},
"functionAppName": {
"type": "String",
"value": "[parameters('FunctionAppName')]"
},
"functionAppPossibleOutboundIpAddresses": {
"type": "String",
"value": "[reference(resourceId('Microsoft.Web/sites', parameters('FunctionAppName')), '2016-08-01').possibleOutboundIpAddresses]"
},
"functionNameFazAuthHandler": {
"type": "String",
"value": "faz-auth-handler"
},
"functionNameFgtAsHandler": {
"type": "String",
"value": "fgt-as-handler"
},
"functionNameLicenseHandler": {
"type": "String",
"value": "byol-license"
}
}
}