|
42 | 42 | "appInsightsApiVersion": "2020-02-02", |
43 | 43 | "webAppApiVersion": "2022-03-01", |
44 | 44 | "keyVaultApiVersion": "2022-07-01", |
| 45 | + "eventHubApiVersion": "2022-01-01-preview", |
45 | 46 | "sku": "Free", |
46 | 47 | "skuCode": "F1", |
47 | 48 | "workerSize": "0", |
48 | 49 | "workerSizeId": "0", |
49 | 50 | "numberOfWorkers": "1", |
50 | 51 | "webAppAlwaysOn": false, |
51 | 52 | "webAppLinuxFxVersion": "NODE|18-lts", |
| 53 | + "eventHubSku": "Basic", |
| 54 | + "eventHubPartitionCount": 1, |
| 55 | + "eventHubMessageRetentionInDays": 1, |
52 | 56 | "tenantId": "[subscription().tenantId]", |
53 | 57 | "hostingPlanName": "[concat(variables('prefix'), 'hosting')]", |
54 | 58 | "webAppName": "[concat(variables('prefix'), 'webapp')]", |
55 | 59 | "appInsightsName": "[concat(variables('prefix'), 'appinsights')]", |
56 | 60 | "storageAccountName": "[concat(variables('prefix'), 'storage')]", |
57 | 61 | "keyVaultName": "[concat(variables('prefix'), 'keys')]", |
| 62 | + "eventHubNamespaceName": "[concat(variables('prefix'), 'ns')]", |
| 63 | + "eventHubAuthorizationRuleName": "gateway", |
| 64 | + "telemetryEventHubName": "telemetry", |
58 | 65 | "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", |
59 | 66 | "keyVaultId": "[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]", |
60 | 67 | "storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", |
61 | 68 | "appInsightsId": "[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]", |
62 | 69 | "webAppId": "[resourceId('Microsoft.Web/sites', variables('webAppName'))]", |
| 70 | + "eventHubNamespaceId": "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]", |
| 71 | + "telemetryEventHubId": "[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('eventHubNamespaceName'), variables('telemetryEventHubName'))]", |
| 72 | + "eventHubAuthorizationRuleId": "[resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubNamespaceName'), variables('eventHubAuthorizationRuleName'))]", |
63 | 73 | "storageConnectionStringSecretName": "storageAccountConnectionString", |
| 74 | + "eventHubConnectionStringSecretName": "eventHubAccountConnectionString", |
64 | 75 | "adminToken": "[concat('admin:', parameters('adminPassword'))]", |
65 | 76 | "passwordsSecretName": "passwords", |
66 | 77 | "adminConnectionStringSecretName": "adminConnectionString" |
67 | 78 | }, |
68 | 79 | "resources": [ |
| 80 | + //event hub |
| 81 | + { |
| 82 | + "type": "Microsoft.EventHub/namespaces", |
| 83 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 84 | + "name": "[variables('eventHubNamespaceName')]", |
| 85 | + "location": "[variables('location')]", |
| 86 | + "sku": { |
| 87 | + "name": "[variables('eventHubSku')]", |
| 88 | + "tier": "[variables('eventHubSku')]", |
| 89 | + "capacity": 1 |
| 90 | + }, |
| 91 | + "properties": { |
| 92 | + "isAutoInflateEnabled": false, |
| 93 | + "maximumThroughputUnits": 0 |
| 94 | + } |
| 95 | + }, |
| 96 | + { |
| 97 | + "type": "Microsoft.EventHub/namespaces/authorizationRules", |
| 98 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 99 | + "name": "[concat(variables('eventHubNamespaceName'), '/', variables('eventHubAuthorizationRuleName'))]", |
| 100 | + "properties": { |
| 101 | + "rights": ["Send"] |
| 102 | + }, |
| 103 | + "dependsOn": ["[variables('eventHubNamespaceId')]"] |
| 104 | + }, |
| 105 | + { |
| 106 | + "type": "Microsoft.EventHub/namespaces/eventhubs", |
| 107 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 108 | + "name": "[concat(variables('eventHubNamespaceName'), '/', variables('telemetryEventHubName'))]", |
| 109 | + "properties": { |
| 110 | + "messageRetentionInDays": "[variables('eventHubMessageRetentionInDays')]", |
| 111 | + "partitionCount": "[variables('eventHubPartitionCount')]" |
| 112 | + }, |
| 113 | + "dependsOn": ["[variables('eventHubNamespaceId')]"] |
| 114 | + }, |
69 | 115 | // storage |
70 | 116 | { |
71 | 117 | "type": "Microsoft.Storage/storageAccounts", |
|
168 | 214 | "type": "Microsoft.KeyVault/vaults/secrets", |
169 | 215 | "apiVersion": "[variables('keyVaultApiVersion')]", |
170 | 216 | "name": "[concat(variables('keyVaultName'), '/', variables('adminConnectionStringSecretName'))]", |
171 | | - "dependsOn": [ |
172 | | - "[variables('keyVaultId')]" |
173 | | - ], |
| 217 | + "dependsOn": ["[variables('keyVaultId')]"], |
174 | 218 | "properties": { |
175 | 219 | "value": "[concat('WebAppName=', variables('webAppName') ,';AccountName=admin;AccountKey=', parameters('adminPassword'), ';EndPointSuffix=azurewebsites.net')]" |
176 | 220 | } |
|
187 | 231 | "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('storageApiVersion')).keys[0].value,';EndpointSuffix=core.windows.net')]" |
188 | 232 | } |
189 | 233 | }, |
| 234 | + { |
| 235 | + "type": "Microsoft.KeyVault/vaults/secrets", |
| 236 | + "apiVersion": "[variables('keyVaultApiVersion')]", |
| 237 | + "name": "[concat(variables('keyVaultName'), '/', variables('eventHubConnectionStringSecretName'))]", |
| 238 | + "dependsOn": [ |
| 239 | + "[variables('keyVaultId')]", |
| 240 | + "[variables('eventHubAuthorizationRuleId')]" |
| 241 | + ], |
| 242 | + "properties": { |
| 243 | + "value": "[listKeys(variables('eventHubAuthorizationRuleId'), variables('eventHubApiVersion')).primaryConnectionString]" |
| 244 | + } |
| 245 | + }, |
190 | 246 | // web |
191 | 247 | { |
192 | 248 | "type": "Microsoft.Web/serverfarms", |
|
220 | 276 | }, |
221 | 277 | "dependsOn": [ |
222 | 278 | "[variables('serverFarmId')]", |
223 | | - "[variables('appInsightsId')]" |
| 279 | + "[variables('appInsightsId')]", |
| 280 | + "[variables('eventHubAuthorizationRuleId')]", |
| 281 | + "[variables('telemetryEventHubId')]" |
224 | 282 | ], |
225 | 283 | "identity": { |
226 | 284 | "type": "SystemAssigned" |
|
242 | 300 | "name": "DEVS_KEY_VAULT_NAME", |
243 | 301 | "value": "[variables('keyVaultName')]" |
244 | 302 | }, |
| 303 | + { |
| 304 | + "name": "DEVS_EVENT_HUB_NAME", |
| 305 | + "value": "[variables('eventHubNamespaceName')]" |
| 306 | + }, |
245 | 307 | { |
246 | 308 | "name": "DEVS_STORAGE_CONNECTION_STRING_SECRET", |
247 | 309 | "value": "[variables('storageConnectionStringSecretName')]" |
248 | 310 | }, |
| 311 | + { |
| 312 | + "name": "DEVS_EVENT_HUB_CONNECTION_STRING_SECRET", |
| 313 | + "value": "[variables('eventHubConnectionStringSecretName')]" |
| 314 | + }, |
249 | 315 | { |
250 | 316 | "name": "DEVS_PASSWORDS_SECRET", |
251 | 317 | "value": "[variables('passwordsSecretName')]" |
|
0 commit comments