Skip to content

Commit a415386

Browse files
jeffhollanGlenn Gailey
authored andcommitted
[functions] hostjson app setting config
1 parent 8d36381 commit a415386

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

articles/azure-functions/functions-app-settings.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ The connection string for Application Insights. Use `APPLICATIONINSIGHTS_CONNECT
3333

3434
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](https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Program.cs#L43). You can set `AZURE_FUNCTIONS_ENVIRONMENT` to any value, but [three values](/dotnet/api/microsoft.aspnetcore.hosting.environmentname) are supported: [Development](/dotnet/api/microsoft.aspnetcore.hosting.environmentname.development), [Staging](/dotnet/api/microsoft.aspnetcore.hosting.environmentname.staging), and [Production](/dotnet/api/microsoft.aspnetcore.hosting.environmentname.production). When `AZURE_FUNCTIONS_ENVIRONMENT` isn't set, it defaults to `Development` on a local environment and `Production` on Azure. This setting should be used instead of `ASPNETCORE_ENVIRONMENT` to set the runtime environment.
3535

36+
## AzureFunctionsJobHost__\*
37+
38+
In version 2.x and later versions of the Functions runtime, application settings can override [host.json](functions-host-json.md) settings in the current environment. These overrides are expressed as application settings named `AzureFunctionsJobHost__path__to__setting`. For more information, see [Override host.json values](functions-host-json.md#override-hostjson-values).
39+
3640
## AzureWebJobsDashboard
3741

3842
Optional storage account connection string for storing logs and displaying them in the **Monitor** tab in the portal. This setting is only valid for apps that target version 1.x of the Azure Functions runtime. The storage account must be a general-purpose one that supports blobs, queues, and tables. To learn more, see [Storage account requirements](storage-considerations.md#storage-account-requirements).

articles/azure-functions/functions-host-json.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: host.json reference for Azure Functions 2.x
33
description: Reference documentation for the Azure Functions host.json file with the v2 runtime.
44
ms.topic: conceptual
5-
ms.date: 01/06/2020
5+
ms.date: 04/28/2020
66
---
77

88
# host.json reference for Azure Functions 2.x and later
@@ -20,6 +20,8 @@ Other function app configuration options are managed in your [app settings](func
2020

2121
Configurations in host.json related to bindings are applied equally to each function in the function app.
2222

23+
You can also [override or apply settings per environment](#override-hostjson-values) using application settings.
24+
2325
## Sample host.json file
2426

2527
The following sample *host.json* file for version 2.x+ has all possible options specified (excluding any that are for internal use only).
@@ -384,6 +386,23 @@ A set of [shared code directories](functions-reference-csharp.md#watched-directo
384386
}
385387
```
386388

389+
## Override host.json values
390+
391+
There may be instances where you wish to configure or modify specific settings in a host.json file for a specific environment, without changing the host.json file itself. You can override specific host.json values be creating an equivalent value as an application setting. When the runtime finds an application setting in the format `AzureFunctionsJobHost__path__to__setting`, it overrides the equivalent host.json setting located at `path.to.setting` in the JSON. When expressed as an application setting, the dot (`.`) used to indicate JSON hierarchy is replaced by a double underscore (`__`).
392+
393+
For example, say that you wanted to disable Application Insight sampling when running locally. If you changed the local host.json file to disable Application Insights, this change might get pushed to your production app during deployment. The safer way to do this is to instead create an application setting as `"AzureFunctionsJobHost__logging__applicationInsights__samplingSettings__isEnabled":"false"` in the `local.settings.json` file. You can see this in the following `local.settings.json` file, which doesn't get published:
394+
395+
```json
396+
{
397+
"IsEncrypted": false,
398+
"Values": {
399+
"AzureWebJobsStorage": "{storage-account-connection-string}",
400+
"FUNCTIONS_WORKER_RUNTIME": "{language-runtime}",
401+
"AzureFunctionsJobHost__logging__applicationInsights__samplingSettings__isEnabled":"false"
402+
}
403+
}
404+
```
405+
387406
## Next steps
388407

389408
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)