Skip to content
55 changes: 49 additions & 6 deletions azure/eventhub_log_forwarder/function_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"variables": {
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storageacct')]",
"authRule": "[resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('eventhubNamespace'),'RootManageSharedAccessKey')]"
"eventHubAuthRule": "[resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('eventhubNamespace'),'RootManageSharedAccessKey')]"
},
"resources": [
{
Expand Down Expand Up @@ -129,7 +129,7 @@
},
{
"name": "EVENTHUB_CONNECTION_STRING",
"value": "[listKeys(variables('authRule'),'2017-04-01').primaryConnectionString]"
"value": "[listKeys(variables('eventHubAuthRule'),'2017-04-01').primaryConnectionString]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
Expand All @@ -143,10 +143,6 @@
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~20"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1"
},
{
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
"value": "true"
Expand All @@ -165,6 +161,53 @@
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('functionAppName'))]"
]
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "[concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity')]",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"name": "[guid('syncFunctionTriggers-', parameters('functionAppName'))]",
"properties": {
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', 'de139f84-1756-47ae-9be6-808fbbe84772')]",
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity')), '2023-01-31').principalId]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity'))]"
]
},
{
"type": "Microsoft.Resources/deploymentScripts",
"apiVersion": "2023-08-01",
"name": "[concat('syncFunctionTriggers-', parameters('functionAppName'))]",
"location": "[parameters('location')]",
"kind": "AzureCLI",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity'))]": {}
}
},
"properties": {
"azCliVersion": "2.67.0",
"scriptContent": "[format('az rest --url ''{0}{1}/syncfunctiontriggers?api-version=2024-04-01'' --method post', environment().resourceManager, resourceId('Microsoft.Web/sites', parameters('functionAppName')))]",
"timeout": "PT30M",
"cleanupPreference": "OnSuccess",
"retentionInterval": "P1D",
"storageAccountSettings": {
"storageAccountName": "[variables('storageAccountName')]",
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value]"
}
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', concat('syncFunctionTriggers-', parameters('functionAppName'), '-identity'))]",
"[resourceId('Microsoft.Web/sites/extensions', parameters('functionAppName'), 'zipdeploy')]"
]
}
]
}
Loading