Eric McNeill
Eric McNeill

Reputation: 1814

Can Azure Functions "function runtime" and "general" settings be set via Bicep or with zip upload?

In the portal for a Functions App, under Configuration there are three sections:

ApplicationSettings
Function runtime settings
General settings

I'm creating my App resources with a Bicep script, where I set the Application Settings, for example FUNCTIONS_EXTENSION_VERSION = '~4' and FUNCTIONS_WORKER_RUNTIME = 'java'.

However I don't see any way to set certain other config options via Bicep, for example the Java Version in General Settings. It just shows up blank in the portal, and if I deploy my code (via zip deploy using "az functionapp deploy") my app doesn't work without Java Version set, and an HTTP trigger times out with a 502.

I can fix the problem with

az functionapp config set --java-version='11'...

but it's driving me nuts that I can set some settings imperatively in a template but not others. Please tell me there's a template property I'm overlooking, or maybe a way to include those settings in host.json or similar. I looked at the gradle and mvn plugins, and the seem to run a bunch of commands under the covers to set this stuff up.

Upvotes: 0

Views: 1457

Answers (1)

Thomas
Thomas

Reputation: 29542

You can refer to the documentation. you would need to set the javaVersion property inside the SiteConfig block:

resource functionApp 'Microsoft.Web/sites@2022-03-01' = {
  ...
  kind: 'functionapp'
  properties: {
    ...
    siteConfig: {
      ...
      javaVersion: '11'
      ...
    }
    ...
  }
}

I would suggest you to configure your function app manually from the portal and then click on the Export template tab, it will show you the generated ARM and help configuring your bicep file: enter image description here

Upvotes: 0

Related Questions