-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
azuredeploy.json
205 lines (205 loc) · 7.51 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
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.28.1.47646",
"templateHash": "14382008126277796973"
}
},
"parameters": {
"appNamePrefix": {
"type": "string",
"maxLength": 14,
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location of the function app that you wish to create."
}
},
"mailAddress": {
"type": "string",
"metadata": {
"description": "Email address for ACME account."
}
},
"acmeEndpoint": {
"type": "string",
"defaultValue": "https://acme-v02.api.letsencrypt.org/directory",
"allowedValues": [
"https://acme-v02.api.letsencrypt.org/directory",
"https://api.buypass.com/acme/directory",
"https://acme.zerossl.com/v2/DV90/",
"https://dv.acme-v02.api.pki.goog/directory"
],
"metadata": {
"description": "Certification authority ACME Endpoint."
}
}
},
"variables": {
"functionAppName": "[format('func-{0}-{1}', parameters('appNamePrefix'), substring(uniqueString(resourceGroup().id, deployment().name), 0, 4))]",
"appServicePlanName": "[format('plan-{0}-{1}', parameters('appNamePrefix'), substring(uniqueString(resourceGroup().id, deployment().name), 0, 4))]",
"appInsightsName": "[format('appi-{0}-{1}', parameters('appNamePrefix'), substring(uniqueString(resourceGroup().id, deployment().name), 0, 4))]",
"workspaceName": "[format('log-{0}-{1}', parameters('appNamePrefix'), substring(uniqueString(resourceGroup().id, deployment().name), 0, 4))]",
"storageAccountName": "[format('st{0}func', uniqueString(resourceGroup().id, deployment().name))]",
"appInsightsEndpoints": {
"AzureCloud": "applicationinsights.azure.com",
"AzureChinaCloud": "applicationinsights.azure.cn",
"AzureUSGovernment": "applicationinsights.us"
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-05-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"kind": "Storage",
"sku": {
"name": "Standard_LRS"
},
"properties": {
"supportsHttpsTrafficOnly": true,
"allowBlobPublicAccess": false,
"minimumTlsVersion": "TLS1_2"
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2023-12-01",
"name": "[variables('appServicePlanName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Y1",
"tier": "Dynamic"
},
"properties": {}
},
{
"type": "Microsoft.OperationalInsights/workspaces",
"apiVersion": "2023-09-01",
"name": "[variables('workspaceName')]",
"location": "[parameters('location')]",
"properties": {
"sku": {
"name": "PerGB2018"
},
"retentionInDays": 30
}
},
{
"type": "Microsoft.Insights/components",
"apiVersion": "2020-02-02",
"name": "[variables('appInsightsName')]",
"location": "[parameters('location')]",
"kind": "web",
"tags": {
"[format('hidden-link:{0}/providers/Microsoft.Web/sites/{1}', resourceGroup().id, variables('functionAppName'))]": "Resource"
},
"properties": {
"Application_Type": "web",
"WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"
},
"dependsOn": [
"[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"
]
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2023-12-01",
"name": "[variables('functionAppName')]",
"location": "[parameters('location')]",
"kind": "functionapp",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"clientAffinityEnabled": false,
"httpsOnly": true,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[format('InstrumentationKey={0};EndpointSuffix={1}', reference(resourceId('Microsoft.Insights/components', variables('appInsightsName')), '2020-02-02').InstrumentationKey, variables('appInsightsEndpoints')[environment().name])]"
},
{
"name": "AzureWebJobsStorage",
"value": "[format('DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1};EndpointSuffix={2}', variables('storageAccountName'), listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2023-05-01').keys[0].value, environment().suffixes.storage)]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[format('DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1};EndpointSuffix={2}', variables('storageAccountName'), listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2023-05-01').keys[0].value, environment().suffixes.storage)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower(variables('functionAppName'))]"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "https://stacmebotprod.blob.core.windows.net/appservice-acmebot/v4/latest.zip"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4"
},
{
"name": "FUNCTIONS_INPROC_NET8_ENABLED",
"value": "1"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
},
{
"name": "Acmebot:SubscriptionId",
"value": "[subscription().subscriptionId]"
},
{
"name": "Acmebot:Contacts",
"value": "[parameters('mailAddress')]"
},
{
"name": "Acmebot:Endpoint",
"value": "[parameters('acmeEndpoint')]"
},
{
"name": "Acmebot:Environment",
"value": "[environment().name]"
}
],
"netFrameworkVersion": "v8.0",
"ftpsState": "Disabled",
"minTlsVersion": "1.2",
"scmMinTlsVersion": "1.2"
}
},
"dependsOn": [
"[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
]
}
],
"outputs": {
"functionAppName": {
"type": "string",
"value": "[variables('functionAppName')]"
},
"principalId": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2023-12-01', 'full').identity.principalId]"
},
"tenantId": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2023-12-01', 'full').identity.tenantId]"
}
}
}