I'm trying to configure AlwaysOn to true for a Function App hosted in Dedicated App Service (with Basic Pricing tier). using the below options using Bicep
Both of the options are not working. Below is the Bicep code.
resource azureFunction 'Microsoft.Web/sites@2020-12-01' = {
name: pFunctionAppName
location: pLocation
kind: 'functionapp'
properties: {
serverFarmId: pServerFarmId
siteConfig: {
//Removed rest of the code for brevity
alwaysOn: true
}
}
}
Update: The code works perfectly. I was running incorrect file. My apologies.
Summarizing the answer from comment discussion op has confirmed that feature is working fine they have deployed incorrect file.
To test reproduce this behavior, I have written an sample bicep template here to create function app that runs on linux app service plan with run time as Java on dedicated app service plan.
Sample Bicep template:
@description('The name of your application')
param applicationName string
@description('The environment (dev, test, prod, ...')
@maxLength(4)
param environment string = 'dev'
@description('The number of this specific instance')
@maxLength(3)
param instanceNumber string = '001'
@description('The Azure region where all resources in this example should be created')
param location string
var appServicePlanName = 'plan-${applicationName}-${environment}-${instanceNumber}'
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: 'stf${take(applicationName,4)}${instanceNumber}'
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
resource hostingPlan 'Microsoft.Web/serverfarms@2020-10-01' = {
name: appServicePlanName
location: location
kind: 'dedicated'
properties: {
reserved: true
}
sku: {
name: 'B1'
tier : 'Basic'
}
}
resource functionApp 'Microsoft.Web/sites@2020-06-01' = {
name: 'app-${applicationName}-${environment}-${instanceNumber}'
location: location
kind: 'functionapp,linux'
properties: {
httpsOnly: true
serverFarmId: hostingPlan.id
clientAffinityEnabled: false
siteConfig: {
linuxFxVersion: 'java|11'
alwayson:true
appSettings: [
// {
// name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
// value: appInsights.properties.InstrumentationKey
// }
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${az.environment().suffixes.storage};AccountKey=${listKeys(storageAccount.id, storageAccount.apiVersion).keys[0].value}'
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4'
}
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'java'
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${az.environment().suffixes.storage};AccountKey=${listKeys(storageAccount.id, storageAccount.apiVersion).keys[0].value}'
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1'
}
]
}
}
}
output application_url string = functionApp.properties.hostNames[0]
Post the deployment we are able to see that always on is enabled refer to the below screenshots attached here.