{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.15.31.15270", "templateHash": "11861629922040246994" } }, "parameters": { "appName": { "type": "string", "defaultValue": "[format('fnapp{0}', uniqueString(resourceGroup().id))]", "metadata": { "description": "The name of the function app that you wish to create." } }, "storageAccountType": { "type": "string", "defaultValue": "Standard_LRS", "allowedValues": [ "Standard_LRS", "Standard_GRS", "Standard_RAGRS" ], "metadata": { "description": "Storage Account type" } }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", "metadata": { "description": "Location for all resources." } }, "appInsightsLocation": { "type": "string", "metadata": { "description": "Location for Application Insights" } }, "runtime": { "type": "string", "defaultValue": "node", "allowedValues": [ "node", "dotnet", "java" ], "metadata": { "description": "The language worker runtime to load in the function app." } } }, "variables": { "functionAppName": "[parameters('appName')]", "hostingPlanName": "[parameters('appName')]", "applicationInsightsName": "[parameters('appName')]", "storageAccountName": "[format('{0}azfunctions', uniqueString(resourceGroup().id))]", "functionWorkerRuntime": "[parameters('runtime')]" }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2022-05-01", "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", "sku": { "name": "[parameters('storageAccountType')]" }, "kind": "Storage", "properties": { "supportsHttpsTrafficOnly": true, "defaultToOAuthAuthentication": true } }, { "type": "Microsoft.Web/serverfarms", "apiVersion": "2021-03-01", "name": "[variables('hostingPlanName')]", "location": "[parameters('location')]", "sku": { "name": "Y1", "tier": "Dynamic" }, "properties": {} }, { "type": "Microsoft.Web/sites", "apiVersion": "2021-03-01", "name": "[variables('functionAppName')]", "location": "[parameters('location')]", "kind": "functionapp", "identity": { "type": "SystemAssigned" }, "properties": { "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", "siteConfig": { "appSettings": [ { "name": "AzureWebJobsStorage", "value": "[format('DefaultEndpointsProtocol=https;AccountName={0};EndpointSuffix={1};AccountKey={2}', variables('storageAccountName'), environment().suffixes.storage, listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2022-05-01').keys[0].value)]" }, { "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", "value": "[format('DefaultEndpointsProtocol=https;AccountName={0};EndpointSuffix={1};AccountKey={2}', variables('storageAccountName'), environment().suffixes.storage, listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2022-05-01').keys[0].value)]" }, { "name": "WEBSITE_CONTENTSHARE", "value": "[toLower(variables('functionAppName'))]" }, { "name": "FUNCTIONS_EXTENSION_VERSION", "value": "~4" }, { "name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "~14" }, { "name": "APPINSIGHTS_INSTRUMENTATIONKEY", "value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').InstrumentationKey]" }, { "name": "FUNCTIONS_WORKER_RUNTIME", "value": "[variables('functionWorkerRuntime')]" } ], "ftpsState": "FtpsOnly", "minTlsVersion": "1.2" }, "httpsOnly": true }, "dependsOn": [ "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]", "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ] }, { "type": "Microsoft.Insights/components", "apiVersion": "2020-02-02", "name": "[variables('applicationInsightsName')]", "location": "[parameters('appInsightsLocation')]", "kind": "web", "properties": { "Application_Type": "web", "Request_Source": "rest" } } ] }