Examine if we can do without the AlwaysOn for the Azure Function
Right now in the ARM template, the Function App is specified as Always On. To accommodate this, we need a scaled up hosting plan which impacts costs. We need to examine if we can do without the AlwaysOn option and just pay per invocation of the function. This brings down costs which is always good 🤑
Should be doable with the Consumption plan. Docs over here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code#create-a-consumption-plan.
Looks like we need to create a hosting plan
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2015-04-01",
"name": "[variables('hostingPlanName')]",
"location": "[resourceGroup().location]",
"properties": {
"name": "[variables('hostingPlanName')]",
"computeMode": "Dynamic",
"sku": "Dynamic"
}
}
Afterwards add 2 appsettings.
In addition, a Consumption plan requires two additional settings in the site configuration: WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE. These properties configure the storage account and file path where the function app code and configuration are stored.
Why was the Always On needed in the first place? We can start using a Consumption Plan, but there might be (or have been) a requirement that triggered the Function to be set to be Always On.
I don't think it is required. I think it was just there because of reasons. Maybe a copy/paste from somewhere or an initial template that was forgotten to edit on this part.