Azure Functions 的应用设置参考App settings reference for Azure Functions

函数应用中的应用设置包含对该函数应用的所有函数产生影响的全局配置选项。App settings in a function app contain global configuration options that affect all functions for that function app. 在本地运行时,这些设置将作为本地环境变量进行访问。When you run locally, these settings are accessed as local environment variables. 本文列出可在函数应用中使用的应用设置。This article lists the app settings that are available in function apps.

可以通过以下几种方法添加、更新和删除函数应用设置:There are several ways that you can add, update, and delete function app settings:

host.json 文件和 local.settings.json 文件中提供了其他全局配置选项。There are other global configuration options in the host.json file and in the local.settings.json file.


可以使用应用程序设置替代 host.json 设置值,而不必更改 host.json 文件本身。You can use application settings to override host.json setting values without having to change the host.json file itself. 这对于需要针对特定环境配置或修改特定 host.json 设置的方案很有用。This is helpful for scenarios where you need to configure or modify specific host.json settings for a specific environment. 这也让你可以更改 host.json 设置,而不必重新发布项目。This also lets you change host.json settings without having to republish your project. 若要了解详细信息,请参阅 host.json 参考文章To learn more, see the host.json reference article.


Application Insights 的检测密钥。The instrumentation key for Application Insights. 仅使用 APPINSIGHTS_INSTRUMENTATIONKEYAPPLICATIONINSIGHTS_CONNECTION_STRING 中的一个。Only use one of APPINSIGHTS_INSTRUMENTATIONKEY or APPLICATIONINSIGHTS_CONNECTION_STRING. 当 Application Insights 在主权云中运行时,请使用 APPLICATIONINSIGHTS_CONNECTION_STRINGWhen Application Insights runs in a sovereign cloud, use APPLICATIONINSIGHTS_CONNECTION_STRING. 有关详细信息,请参阅如何配置对 Azure Functions 的监视For more information, see How to configure monitoring for Azure Functions.

Key 示例值Sample value
APPINSIGHTS_INSTRUMENTATIONKEYAPPINSIGHTS_INSTRUMENTATIONKEY 55555555-af77-484b-9032-64f83bb83bb55555555-af77-484b-9032-64f83bb83bb



  • 当函数应用需要通过连接字符串提供支持的已添加自定义项时。When your function app requires the added customizations supported by using the connection string.
  • 当 Application Insights 实例在需要自定义终结点的主权云中运行时。When your Application Insights instance runs in a sovereign cloud, which requires a custom endpoint.

有关详细信息,请参阅连接字符串For more information, see Connection strings.

Key 示例值Sample value
APPLICATIONINSIGHTS_CONNECTION_STRINGAPPLICATIONINSIGHTS_CONNECTION_STRING InstrumentationKey=[key];IngestionEndpoint=[url];LiveEndpoint=[url];ProfilerEndpoint=[url];SnapshotEndpoint=[url];InstrumentationKey=[key];IngestionEndpoint=[url];LiveEndpoint=[url];ProfilerEndpoint=[url];SnapshotEndpoint=[url];


默认情况下,Functions 代理使用快捷方式从代理直接将 API 调用发送到同一函数应用中的函数。By default, Functions proxies use a shortcut to send API calls from proxies directly to functions in the same function app. 使用此快捷方式取代创建新的 HTTP 请求。This shortcut is used instead of creating a new HTTP request. 此设置让你能够禁用该快捷方式行为。This setting allows you to disable that shortcut behavior.

Key Value 说明Description
AZURE_FUNCTION_PROXY_DISABLE_LOCAL_CALLAZURE_FUNCTION_PROXY_DISABLE_LOCAL_CALL true 具有指向本地函数应用中函数的后端 URL 的调用不会直接发送到函数,Calls with a backend URL pointing to a function in the local function app won't be sent directly to the function. 相反,请求会定向回函数应用的 HTTP 前端。Instead, the requests are directed back to the HTTP frontend for the function app.
AZURE_FUNCTION_PROXY_DISABLE_LOCAL_CALLAZURE_FUNCTION_PROXY_DISABLE_LOCAL_CALL falsefalse 具有指向本地函数应用中函数的后端 URL 的调用会直接转发到函数。Calls with a backend URL pointing to a function in the local function app are forwarded directly to the function. 这是默认值。This is the default value.


此设置控制字符 %2F 在路由参数插入后端 URL 时是否在路由参数中解码为斜杠。This setting controls whether the characters %2F are decoded as slashes in route parameters when they are inserted into the backend URL.

Key Value 说明Description
AZURE_FUNCTION_PROXY_BACKEND_URL_DECODE_SLASHESAZURE_FUNCTION_PROXY_BACKEND_URL_DECODE_SLASHES falsefalse 所有路由参数均原样传递,这是默认行为。All route parameters are passed along unchanged, which is the default behavior.

例如,考虑位于 域的函数应用的 proxies.json 文件。For example, consider the proxies.json file for a function app at the domain.

    "$schema": "",
    "proxies": {
        "root": {
            "matchCondition": {
                "route": "/{*all}"
            "backendUri": "{all}"

如果 AZURE_FUNCTION_PROXY_BACKEND_URL_DECODE_SLASHES 设置为 true,则 URL 解析为 AZURE_FUNCTION_PROXY_BACKEND_URL_DECODE_SLASHES is set to true, the URL resolves to 默认情况下,URL 保持为 不变。By default, the URL remains unchanged as 有关详细信息,请参阅 Functions 代理For more information, see Functions proxies.


在 2.x 和更高版本的 Functions 运行时中,基于运行时环境配置应用行为。In version 2.x and later versions of the Functions runtime, configures app behavior based on the runtime environment. 在初始化期间读取此值。This value is read during initialization. 可以将 AZURE_FUNCTIONS_ENVIRONMENT 设置为任何值,但支持三个值DevelopmentStagingProductionYou can set AZURE_FUNCTIONS_ENVIRONMENT to any value, but three values are supported: Development, Staging, and Production. 如果未设置 AZURE_FUNCTIONS_ENVIRONMENT,则在本地环境中默认为 Development,在 Azure 中默认为 ProductionWhen AZURE_FUNCTIONS_ENVIRONMENT isn't set, it defaults to Development on a local environment and Production on Azure. 应使用此设置(而不是 ASPNETCORE_ENVIRONMENT)来设置运行时环境。This setting should be used instead of ASPNETCORE_ENVIRONMENT to set the runtime environment.


在 Functions 运行时的版本 2.x 和更高版本中,应用程序设置可以替代当前环境中的 host.json 设置。In version 2.x and later versions of the Functions runtime, application settings can override host.json settings in the current environment. 这些替代表示为名为 AzureFunctionsJobHost__path__to__setting 的应用程序设置。These overrides are expressed as application settings named AzureFunctionsJobHost__path__to__setting. 有关详细信息,请参阅替代 host.json 值For more information, see Override host.json values.


用于存储日志并在门户上的“监视”选项卡中显示这些日志的可选存储帐户连接字符串。Optional storage account connection string for storing logs and displaying them in the Monitor tab in the portal. 此设置仅对面向 Azure Functions 运行时版本 1.x 的应用有效。This setting is only valid for apps that target version 1.x of the Azure Functions runtime. 存储帐户必须是支持 Blob、队列和表的通用帐户。The storage account must be a general-purpose one that supports blobs, queues, and tables. 有关详细信息,请参阅存储帐户要求To learn more, see Storage account requirements.

Key 示例值Sample value
AzureWebJobsDashboardAzureWebJobsDashboard DefaultEndpointsProtocol=https;AccountName=;AccountKey=;EndpointSuffix=core.chinacloudapi.cnDefaultEndpointsProtocol=https;AccountName=;AccountKey=;


为了获得更好的性能和体验,运行时版本 2.x 及更高版本使用 APPINSIGHTS_INSTRUMENTATIONKEY 和 App Insights 进行监视,而不是使用 AzureWebJobsDashboardFor better performance and experience, runtime version 2.x and later versions use APPINSIGHTS_INSTRUMENTATIONKEY and App Insights for monitoring instead of AzureWebJobsDashboard.


true 表示禁用针对函数应用根 URL 显示的默认登录页。true means disable the default landing page that is shown for the root URL of a function app. 默认值为 falseDefault is false.

Key 示例值Sample value
AzureWebJobsDisableHomepageAzureWebJobsDisableHomepage true

如果省略此应用设置或将其设置为 false,则会显示类似于以下示例的页来响应 URL <functionappname>.chinacloudsites.cnWhen this app setting is omitted or set to false, a page similar to the following example is displayed in response to the URL <functionappname>



true 表示在编译 .NET 代码时使用“发布”模式;false 表示使用“调试”模式。true means use Release mode when compiling .NET code; false means use Debug mode. 默认值为 trueDefault is true.

Key 示例值Sample value
AzureWebJobsDotNetReleaseCompilationAzureWebJobsDotNetReleaseCompilation true


要启用的 beta 功能的逗号分隔列表。A comma-delimited list of beta features to enable. 由这些标志启用的 Beta 功能尚未准备好用于生产,但在发布这些功能之前可针对试验目的启用这些功能。Beta features enabled by these flags are not production ready, but can be enabled for experimental use before they go live.

Key 示例值Sample value
AzureWebJobsFeatureFlagsAzureWebJobsFeatureFlags feature1,feature2feature1,feature2


指定用于密钥存储的存储库或提供程序。Specifies the repository or provider to use for key storage. 目前,支持的存储库包括 blob 存储(“Blob”)和本地文件系统(“Files”)。Currently, the supported repositories are blob storage ("Blob") and the local file system ("Files"). 默认为在版本 2 中使用 blob,在版本 1 中使用文件系统。The default is blob in version 2 and file system in version 1.

Key 示例值Sample value
AzureWebJobsSecretStorageTypeAzureWebJobsSecretStorageType 文件Files


Azure Functions 运行时使用此存储帐户连接字符串执行常规操作。The Azure Functions runtime uses this storage account connection string for normal operation. 此存储帐户的一些用途包括密钥管理、计时器触发器管理和事件中心检查点。Some uses of this storage account include key management, timer trigger management, and Event Hubs checkpoints. 存储帐户必须是支持 Blob、队列和表的通用帐户。The storage account must be a general-purpose one that supports blobs, queues, and tables. 请参阅存储帐户存储帐户要求See Storage account and Storage account requirements.

Key 示例值Sample value
AzureWebJobsStorageAzureWebJobsStorage DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key];EndpointSuffix=core.chinacloudapi.cnDefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key];


用于 TypeScript 的编译器的路径。Path to the compiler used for TypeScript. 允许根据需要重写默认值。Allows you to override the default if you need to.

Key 示例值Sample value
AzureWebJobs_TypeScriptPathAzureWebJobs_TypeScriptPath %HOME%\typescript%HOME%\typescript


指示是否在 Azure 门户中启用了编辑。Dictates whether editing in the Azure portal is enabled. 有效值为“readwrite”和“readonly”。Valid values are "readwrite" and "readonly".

Key 示例值Sample value


要在此函数应用中使用的 Functions 运行时版本。The version of the Functions runtime to use in this function app. 波浪符加主要版本号表示使用该主要版本的最新版本(例如“~2”)。A tilde with major version means use the latest version of that major version (for example, "~2"). 当同一主要版本的新版本可用时,会自动在函数应用中安装新版本。When new versions for the same major version are available, they are automatically installed in the function app. 若要让应用固定使用特定的版本,请使用完整版本号(例如“2.0.12345”)。To pin the app to a specific version, use the full version number (for example, "2.0.12345"). 默认值为“~2”。Default is "~2". ~1 让应用固定使用运行时版本 1.x。A value of ~1 pins your app to version 1.x of the runtime.

Key 示例值Sample value


此设置使函数应用能够在版本 3.x 运行时上以版本 2.x 兼容模式运行。This setting enables your function app to run in a version 2.x compatible mode on the version 3.x runtime. 仅当在将函数应用从运行时版本 2.x 升级到版本 3.x 时遇到问题的情况下,才使用此设置。Use this setting only if encountering issues when upgrading your function app from version 2.x to 3.x of the runtime.


在更新应用以便在版本 3.x 上正常运行时,此设置仅用作短期解决方法。This setting is intended only as a short-term workaround while you update your app to run correctly on version 3.x. 只要 2.x 运行时受支持,此设置就受支持。This setting is supported as long as the 2.x runtime is supported. 如果在不使用此设置的情况下遇到阻止应用在版本 3.x 上运行的问题,请报告问题If you encounter issues that prevent your app from running on version 3.x without using this setting, please report your issue.


Key 示例值Sample value


指定语言工作进程的最大数量,其默认值为 1Specifies the maximum number of language worker processes, with a default value of 1. 允许的最大值为 10The maximum value allowed is 10. 函数调用均匀地分布在语言工作进程中。Function invocations are evenly distributed among language worker processes. 语言工作进程每 10 秒生成一次,直到达到 FUNCTIONS_WORKER_PROCESS_COUNT 设置的计数。Language worker processes are spawned every 10 seconds until the count set by FUNCTIONS_WORKER_PROCESS_COUNT is reached. 使用多个语言工作进程与缩放不同。Using multiple language worker processes is not the same as scaling. 当工作负荷混合使用 CPU 绑定和 I/O 绑定调用时,请考虑使用此设置。Consider using this setting when your workload has a mix of CPU-bound and I/O-bound invocations. 此设置适用于所有非 .NET 语言。This setting applies to all non-.NET languages.

Key 示例值Sample value


要在函数应用中加载的语言辅助角色运行时。The language worker runtime to load in the function app. 这将对应于应用程序中使用的语言(例如,“dotnet”)。This will correspond to the language being used in your application (for example, "dotnet"). 对于使用多种语言的函数,需要将这些函数发布到多个应用(每个应用程序都有相应的辅助角色运行时值)。For functions in multiple languages you will need to publish them to multiple apps, each with a corresponding worker runtime value. 有效值为 dotnet (C#/F#)、node (JavaScript/TypeScript)、java (Java)、powershell (PowerShell)。Valid values are dotnet (C#/F#), node (JavaScript/TypeScript), java (Java), powershell (PowerShell).

Key 示例值Sample value


此设置当前处于预览状态。This setting is currently in preview.

此设置控制 Azure Functions 缩放控制器中的日志记录。This setting controls logging from the Azure Functions scale controller. 有关详细信息,请参阅缩放控制器日志For more information, see Scale controller logs.

Key 示例值Sample value

此键的值以 <DESTINATION>:<VERBOSITY> 格式提供,其定义如下:The value for this key is supplied in the format <DESTINATION>:<VERBOSITY>, which is defined as follows:

<DESTINATION> 日志发送到的目标。The destination to which logs are sent. 有效值为 AppInsightsBlobValid values are AppInsights and Blob.
使用 AppInsights 时,请确保在函数应用中启用 Application InsightsWhen you use AppInsights, make sure Application Insights is enabled in your function app.
将目标设置为 Blob 时,将在名为 azure-functions-scale-controller 的 blob 容器中创建日志,该容器位于 AzureWebJobsStorage 应用程序设置中设置的默认存储帐户中。When you set the destination to Blob, logs are created in a blob container named azure-functions-scale-controller in the default storage account set in the AzureWebJobsStorage application setting.
<VERBOSITY> 指定日志记录级别。Specifies the level of logging. 支持的值为 NoneWarningVerboseSupported values are None, Warning, and Verbose.
设置为 Verbose 时,缩放控制器将记录辅助角色计数每次更改的原因,以及有关将这些因素纳入决策的触发器的信息。When set to Verbose, the scale controller logs a reason for every change in the worker count, as well as information about the triggers that factor into those decisions. 详细日志包含触发器警告和缩放控制器运行前后触发器使用的哈希。Verbose logs include trigger warnings and the hashes used by the triggers before and after the scale controller runs.


请记住,将“缩放控制器日志记录”保留为启用时,它会影响监视函数应用的潜在成本Keep in mind that while you leave scale controller logging enabled, it impacts the potential costs of monitoring your function app. 请考虑启用日志记录,直到收集到的数据足以了解缩放控制器的行为方式,然后将其禁用。Consider enabling logging until you have collected enough data to understand how the scale controller is behaving, and then disabling it.


仅用于消耗计划和高级计划。For Consumption & Premium plans only. 存储函数应用代码和配置的存储帐户的连接字符串。Connection string for storage account where the function app code and configuration are stored. 请参阅创建函数应用See Create a function app.

Key 示例值Sample value
WEBSITE_CONTENTAZUREFILECONNECTIONSTRINGWEBSITE_CONTENTAZUREFILECONNECTIONSTRING DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key]DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key]


仅用于高级计划。For Premium plans only. 将存储帐户限制在虚拟网络中时,值 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.

Key 示例值Sample value


仅用于消耗计划和高级计划。For Consumption & Premium plans only. 函数应用代码和配置的文件路径。The file path to the function app code and configuration. 与 WEBSITE_CONTENTAZUREFILECONNECTIONSTRING 结合使用。Used with WEBSITE_CONTENTAZUREFILECONNECTIONSTRING. 默认值是以函数应用名称开头的唯一字符串。Default is a unique string that begins with the function app name. 请参阅创建函数应用See Create a function app.

Key 示例值Sample value
WEBSITE_CONTENTSHAREWEBSITE_CONTENTSHARE functionapp091999e2functionapp091999e2


函数应用可以横向扩展到的最大实例数。The maximum number of instances that the function app can scale out to. 默认值为无限制。Default is no limit.


此设置处于预览状态。This setting is in preview. 添加了一个函数应用横向扩展上限属性,建议使用此方法限制横向扩展。An app property for function max scale out has been added and is the recommended way to limit scale out.

Key 示例值Sample value


仅限 WindowsWindows only.
设置在 Windows 上运行函数应用时要使用的 Node.js 版本。Sets the version of Node.js to use when running your function app on Windows. 应使用波形符 (~) 让运行时使用目标主版本的最新可用版本。You should use a tilde (~) to have the runtime use the latest available version of the targeted major version. 例如,当设置为 ~10 时,将使用最新版本 Node.js 10。For example, when set to ~10, the latest version of Node.js 10 is used. 当目标主版本带有波形符时,无需手动更新次版本。When a major version is targeted with a tilde, you don't have to manually update the minor version.

Key 示例值Sample value


让函数应用从已装载的包文件运行。Enables your function app to run from a mounted package file.

Key 示例值Sample value

有效值是解析为部署包文件位置的 URL 或 1Valid values are either a URL that resolves to the location of a deployment package file, or 1. 设置为 1 时,包必须位于 d:\home\data\SitePackages 文件夹中。When set to 1, the package must be in the d:\home\data\SitePackages folder. 使用此设置的 zip 部署时,包将自动上传到此位置。When using zip deployment with this setting, the package is automatically uploaded to this location. 在预览版中,此设置名为 WEBSITE_RUN_FROM_ZIPIn preview, this setting was named WEBSITE_RUN_FROM_ZIP. 有关详细信息,请参阅从包文件运行函数For more information, see Run your functions from a package file.


允许为函数应用设置时区。Allows you to set the timezone for your function app.

Key (OS)OS 示例值Sample value
WEBSITE_TIME_ZONEWEBSITE_TIME_ZONE WindowsWindows 东部标准时间Eastern Standard Time

CRON 表达式使用的默认时区为协调世界时 (UTC)。The default time zone used with the CRON expressions is Coordinated Universal Time (UTC). 若要让 CRON 表达式基于其他时区,请为你的函数应用创建一个名为 WEBSITE_TIME_ZONE 的应用设置。To have your CRON expression based on another time zone, create an app setting for your function app named WEBSITE_TIME_ZONE.

此设置的值取决于运行函数应用的操作系统和计划。The value of this setting depends on the operating system and plan on which your function app runs.

操作系统Operating system 计划Plan Value
WindowsWindows AllAll 将该值设置为所需时区的名称,由 Windows 命令 tzutil.exe /L 给定的每个对的第二行指定Set the value to the name of the desired time zone as given by the second line from each pair given by the Windows command tzutil.exe /L


Linux 消耗计划目前不支持 WEBSITE_TIME_ZONEWEBSITE_TIME_ZONE is not currently supported on the Linux Consumption plan.

例如,美国东部时间(由 Eastern Standard Time (Windows) 或 America/New_York (Linux) 表示)当前在标准时间中使用 UTC-05:00,在夏令时中使用 UTC-04:00。For example, Eastern Time in the US (represented by Eastern Standard Time (Windows) or America/New_York (Linux)) currently uses UTC-05:00 during standard time and UTC-04:00 during daylight time. 若要使计时器触发器每天在东部时间上午 10:00 触发,请为函数应用创建一个名为 WEBSITE_TIME_ZONE 的应用设置并将值设置为 Eastern Standard Time (Windows) 或 America/New_York (Linux),然后使用以下 NCRONTAB 表达式:To have a timer trigger fire at 10:00 AM Eastern Time every day, create an app setting for your function app named WEBSITE_TIME_ZONE, set the value to Eastern Standard Time (Windows) or America/New_York (Linux), and then use the following NCRONTAB expression:

"0 0 10 * * *"

使用 WEBSITE_TIME_ZONE 时,时间将针对特定时区中的时间更改进行调整,包括夏令时和标准时间的更改。When you use WEBSITE_TIME_ZONE the time is adjusted for time changes in the specific timezone, including daylight saving time and changes in standard time.

后续步骤Next steps

了解如何更新应用设置Learn how to update app settings

查看 host.json 文件中的全局设置See global settings in the host.json file

查看应用服务应用的其他应用设置See other app settings for App Service apps