To configure the runtime stack for an App Service in a Bicep script, you can use the siteConfig
property of the Microsoft.Web/sites
resource Here’s how you can set the runtime stack for your web app service to Node.js - ~18 and your webapp-api app service to Dotnetcore:
resource appserviceplan 'Microsoft.Web/serverfarms@2022-09-01' = {
name: 'appserviceplan1'
location: location
sku: {
name: 'S1'
capacity: 1
}
}
resource appserviceapi 'Microsoft.Web/sites@2022-09-01' = {
name: 'appservice-webapp-api1'
location: location
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', appserviceplan.name)
siteConfig: {
appSettings: [
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'dotnet'
}
]
}
}
dependsOn: [
appserviceplan
]
}
resource appservice 'Microsoft.Web/sites@2022-09-01' = {
name: 'appservice-webappservice-app1'
location: location
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', appserviceplan.name)
siteConfig: {
appSettings: [
{
name: 'WEBSITE_NODE_DEFAULT_VERSION'
value: '~18'
}
]
}
}
dependsOn: [
appserviceapi
]
}
In this example, its set the siteConfig
property of each Microsoft.Web/sites
resource to include an appSettings
array with a single object that specifies the desired runtime stack. For the web app service, we set the WEBSITE_NODE_DEFAULT_VERSION
to ~18
, and for the webapp-api app service, we set the FUNCTIONS_WORKER_RUNTIME
to dotnet
.
-Grace