|
64 | 64 | }, |
65 | 65 | "variables": { |
66 | 66 | "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storageacct')]", |
67 | | - "authRule": "[resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('eventhubNamespace'),'RootManageSharedAccessKey')]" |
| 67 | + "eventHubAuthRule": "[resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('eventhubNamespace'),'RootManageSharedAccessKey')]" |
68 | 68 | }, |
69 | 69 | "resources": [ |
70 | 70 | { |
|
129 | 129 | }, |
130 | 130 | { |
131 | 131 | "name": "EVENTHUB_CONNECTION_STRING", |
132 | | - "value": "[listKeys(variables('authRule'),'2017-04-01').primaryConnectionString]" |
| 132 | + "value": "[listKeys(variables('eventHubAuthRule'),'2017-04-01').primaryConnectionString]" |
133 | 133 | }, |
134 | 134 | { |
135 | 135 | "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", |
|
143 | 143 | "name": "WEBSITE_NODE_DEFAULT_VERSION", |
144 | 144 | "value": "~20" |
145 | 145 | }, |
146 | | - { |
147 | | - "name": "WEBSITE_RUN_FROM_PACKAGE", |
148 | | - "value": "1" |
149 | | - }, |
150 | 146 | { |
151 | 147 | "name": "SCM_DO_BUILD_DURING_DEPLOYMENT", |
152 | 148 | "value": "true" |
|
165 | 161 | "dependsOn": [ |
166 | 162 | "[resourceId('Microsoft.Web/sites', parameters('functionAppName'))]" |
167 | 163 | ] |
| 164 | + }, |
| 165 | + { |
| 166 | + "type": "Microsoft.ManagedIdentity/userAssignedIdentities", |
| 167 | + "apiVersion": "2023-01-31", |
| 168 | + "name": "[concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity')]", |
| 169 | + "location": "[parameters('location')]" |
| 170 | + }, |
| 171 | + { |
| 172 | + "type": "Microsoft.Authorization/roleAssignments", |
| 173 | + "apiVersion": "2022-04-01", |
| 174 | + "name": "[guid('syncFunctionTriggers-', parameters('functionAppName'))]", |
| 175 | + "properties": { |
| 176 | + "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', 'de139f84-1756-47ae-9be6-808fbbe84772')]", |
| 177 | + "principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity')), '2023-01-31').principalId]", |
| 178 | + "principalType": "ServicePrincipal" |
| 179 | + }, |
| 180 | + "dependsOn": [ |
| 181 | + "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity'))]" |
| 182 | + ] |
| 183 | + }, |
| 184 | + { |
| 185 | + "type": "Microsoft.Resources/deploymentScripts", |
| 186 | + "apiVersion": "2023-08-01", |
| 187 | + "name": "[concat('syncFunctionTriggers-', parameters('functionAppName'))]", |
| 188 | + "location": "[parameters('location')]", |
| 189 | + "kind": "AzureCLI", |
| 190 | + "identity": { |
| 191 | + "type": "UserAssigned", |
| 192 | + "userAssignedIdentities": { |
| 193 | + "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity'))]": {} |
| 194 | + } |
| 195 | + }, |
| 196 | + "properties": { |
| 197 | + "azCliVersion": "2.67.0", |
| 198 | + "scriptContent": "[format('az rest --url ''{0}{1}/syncfunctiontriggers?api-version=2024-04-01'' --method post', environment().resourceManager, resourceId('Microsoft.Web/sites', parameters('functionAppName')))]", |
| 199 | + "timeout": "PT30M", |
| 200 | + "cleanupPreference": "OnSuccess", |
| 201 | + "retentionInterval": "P1D", |
| 202 | + "storageAccountSettings": { |
| 203 | + "storageAccountName": "[variables('storageAccountName')]", |
| 204 | + "storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value]" |
| 205 | + } |
| 206 | + }, |
| 207 | + "dependsOn": [ |
| 208 | + "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity'))]", |
| 209 | + "[resourceId('Microsoft.Web/sites/extensions', parameters('functionAppName'), 'zipdeploy')]" |
| 210 | + ] |
168 | 211 | } |
169 | 212 | ] |
170 | 213 | } |
0 commit comments