param location string = resourceGroup().location param storageAccountName string param functionAppName string = 'fn-${uniqueString(resourceGroup().id)}' var appServicePlanName = 'MyPlan' var applicationInsightsName = 'MyApplicationInsights' resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' existing = { name: storageAccountName } var storageAccountConnectionString = 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${listKeys(storageAccount.id, storageAccount.apiVersion).keys[0].value}' resource functionApp 'Microsoft.Web/sites@2021-02-01' = { name: functionAppName location: location kind: 'functionapp' properties: { httpsOnly: true serverFarmId: appServicePlan.id siteConfig: { appSettings: [ { name: 'APPINSIGHTS_INSTRUMENTATIONKEY' value: applicationInsights.properties.InstrumentationKey } { name: 'AzureWebJobsStorage' value: storageAccountConnectionString } { name: 'FUNCTIONS_EXTENSION_VERSION' value: '~3' } { name: 'FUNCTIONS_WORKER_RUNTIME' value: 'dotnet' } { name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING' value: storageAccountConnectionString } ] } } } resource appServicePlan 'Microsoft.Web/serverfarms@2020-10-01' = { name: appServicePlanName location: location sku: { name: 'Y1' tier: 'Dynamic' } } resource applicationInsights 'Microsoft.Insights/components@2020-02-02-preview' = { name: applicationInsightsName location: location kind: 'web' properties: { Application_Type: 'web' publicNetworkAccessForIngestion: 'Enabled' publicNetworkAccessForQuery: 'Enabled' } }