Skip to content

App Settings for Function Apps

Chandni Patel edited this page Nov 10, 2022 · 7 revisions

Strongly Recommended

It is strongly recommended that this setting to be set at app creation time and immutable thru out the lifetime of an app. In fact, there is no scenario that one would need to change this setting occasionally or especially during deployment. Modifying this will cause the deployment and app runtime to behavior incorrectly, guaranteed downtime and data loss perception (deployed files are not where they are expected because imagine swapping a hard drive while installing a software to a computer).


App settings supported by OS and SKU

appSettings Windows Consumption plan Windows Premium plan Windows App Service plan Linux Consumption plan Linux Premium plan Linux App Service plan
APPINSIGHTS_INSTRUMENTATIONKEY ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes
APPLICATIONINSIGHTS_CONNECTION_STRING ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes
AzureWebJobsStorage ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes
FUNCTIONS_EXTENSION_VERSION ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes
FUNCTIONS_WORKER_RUNTIME ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes ✅Yes
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING ✅Yes ✅Yes ❌No ✅Yes ✅Yes ❌No
WEBSITE_CONTENTSHARE ✅Yes ✅Yes ❌No ✅Yes ✅Yes ❌No
WEBSITE_RUN_FROM_PACKAGE = 1 ✅Yes ✅Yes ✅Yes ❌No ✅Yes ✅Yes
WEBSITE_NODE_DEFAULT_VERSION = ~14 ✅Yes - for node.js only ✅Yes - for node.js only ✅Yes - for node.js only ❌No ❌No ❌No

Required Settings

App setting required for all OS and SKU:

  • AzureWebJobsStorage

App setting required for Premium plan or Consumption plan on Windows and Premium plan on Linux:

  • WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
  • WEBSITE_CONTENTSHARE

NOTE: In ARM template, for Windows, do not need to set the WEBSITE_CONTENTSHARE setting in a deployment slot, because it is generated for you when the app is created in the deployment slot.

NOTE: In ARM template, for Windows, do not need to set the WEBSITE_CONTENTSHARE setting for Elastic Premium plan, because it is generated for you when the site is first created.


Application Insights

Only use one of APPINSIGHTS_INSTRUMENTATIONKEY or APPLICATIONINSIGHTS_CONNECTION_STRING.

Key Sample Value
APPINSIGHTS_INSTRUMENTATIONKEY 55555555-af77-484b-9032-64f83bb83bb
APPLICATIONINSIGHTS_CONNECTION_STRING InstrumentationKey=...

Use APPLICATIONINSIGHTS_CONNECTION_STRING instead of APPINSIGHTS_INSTRUMENTATIONKEY in the following cases:

  • When your function app requires the added customizations supported by using the connection string.
  • When your Application Insights instance runs in a sovereign cloud, which requires a custom endpoint.

WEBSITE_RUN_FROM_PACKAGE

  • The app setting WEBSITE_RUN_FROM_PACKAGE=1 is needed for Zip Deploy with Run From Package. It is the recommended path of deployment, except Linux Consumption plan.
  • For Linux Consumption plan, do not use ZipDeploy extension. Set appSetting WEBSITE_RUN_FROM_PACKAGE=URL for deployment using the .zip package url.

Only when Remote Build is Required

The deployment process assumes that the .zip file that you push contains a ready-to-run app. By default, no customizations are run.

However, when remote build is needed (for example: to get Linux specific packages in python, node.js), you can configure Azure Functions to perform remote build on the code after zip deployments. These builds behave slightly differently depending on whether your app is running on Windows or Linux.

For Windows:

When an app is deployed to Windows, language-specific commands, like dotnet restore (C#) or npm install (JavaScript) are run.

To enable the same build processes that you get with continuous integration, add the following to your application settings:

  • WEBSITE_RUN_FROM_PACKAGE=0 or Remove WEBSITE_RUN_FROM_PACKAGE app setting
  • SCM_DO_BUILD_DURING_DEPLOYMENT=true

For Linux:

To enable the same build processes that you get with continuous integration, add the following to your application settings:

  • WEBSITE_RUN_FROM_PACKAGE=0 or Remove WEBSITE_RUN_FROM_PACKAGE app setting
  • SCM_DO_BUILD_DURING_DEPLOYMENT=true

For Functions app on Linux, ENABLE_ORYX_BUILD=true is set by default. If this build does not work for you e.g. for dotnet or java app, then set ENABLE_ORYX_BUILD=false.

When apps are built remotely on Linux, they run from package.


App settings used with Virtual Network

WEBSITE_CONTENTOVERVNET = 1

  • A value of 1 enables your function app to scale when you have your storage account restricted to a virtual network. You should enable this setting when restricting your storage account to a virtual network. To learn more, see Restrict your storage account to a virtual network.
  • Supported on Premium and Dedicated (App Service) plans (Standard and higher). Not supported when running on a Consumption plan.

WEBSITE_VNET_ROUTE_ALL = 1


App settings used with Deployment Slots

WEBSITE_SKIP_ALL_BINDINGS_IN_APPHOST_CONFIG = 1

  • Set to 1 to skip all bindings in applicationHost.config. If your app triggers a restart because applicationHost.config is updated with the swapped hostnames of the slots, set this variable to true to avoid a restart of this kind. It is set to avoid restart during deployment slot swap if there was a restart due to the addition of the bindings.
  • If you are running a Windows Communication Foundation (WCF) app, do not set this variable.