Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The host.json metadata file contains configuration options that affect all functions in a function app instance. This article lists the settings that are available for the version 1.x runtime. The JSON schema is at http://json.schemastore.org/host.
Note
This article is for Azure Functions 1.x. For a reference of host.json in Functions 2.x and later, see host.json reference for Azure Functions 2.x.
Other function app configuration options are managed in your app settings.
Some host.json settings are only used when running locally in the local.settings.json file.
Sample host.json file
The following sample host.json files have all possible options specified.
{
"aggregator": {
"batchSize": 1000,
"flushTimeout": "00:00:30"
},
"applicationInsights": {
"sampling": {
"isEnabled": true,
"maxTelemetryItemsPerSecond" : 5
}
},
"documentDB": {
"connectionMode": "Gateway",
"protocol": "Https",
"leaseOptions": {
"leasePrefix": "prefix"
}
},
"eventHub": {
"maxBatchSize": 64,
"prefetchCount": 256,
"batchCheckpointFrequency": 1
},
"functions": [ "QueueProcessor", "GitHubWebHook" ],
"functionTimeout": "00:05:00",
"healthMonitor": {
"enabled": true,
"healthCheckInterval": "00:00:10",
"healthCheckWindow": "00:02:00",
"healthCheckThreshold": 6,
"counterThreshold": 0.80
},
"http": {
"routePrefix": "api",
"maxOutstandingRequests": 20,
"maxConcurrentRequests": 10,
"dynamicThrottlesEnabled": false
},
"id": "9f4ea53c5136457d883d685e57164f08",
"logger": {
"categoryFilter": {
"defaultLevel": "Information",
"categoryLevels": {
"Host": "Error",
"Function": "Error",
"Host.Aggregator": "Information"
}
}
},
"queues": {
"maxPollingInterval": 2000,
"visibilityTimeout" : "00:00:30",
"batchSize": 16,
"maxDequeueCount": 5,
"newBatchThreshold": 8
},
"sendGrid": {
"from": "Contoso Group <[email protected]>"
},
"serviceBus": {
"maxConcurrentCalls": 16,
"prefetchCount": 100,
"autoRenewTimeout": "00:05:00",
"autoComplete": true
},
"singleton": {
"lockPeriod": "00:00:15",
"listenerLockPeriod": "00:01:00",
"listenerLockRecoveryPollingInterval": "00:01:00",
"lockAcquisitionTimeout": "00:01:00",
"lockAcquisitionPollingInterval": "00:00:03"
},
"tracing": {
"consoleLevel": "verbose",
"fileLoggingMode": "debugOnly"
},
"watchDirectories": [ "Shared" ],
}
The following sections of this article explain each top-level property. All are optional unless otherwise indicated.
aggregator
Specifies how many function invocations are aggregated when calculating metrics for Application Insights.
{
"aggregator": {
"batchSize": 1000,
"flushTimeout": "00:00:30"
}
}
| Property | Default | Description |
|---|---|---|
| batchSize | 1000 | Maximum number of requests to aggregate. |
| flushTimeout | 00:00:30 | Maximum time period to aggregate. |
Function invocations are aggregated when the first of the two limits are reached.
applicationInsights
Controls the sampling feature in Application Insights.
{
"applicationInsights": {
"sampling": {
"isEnabled": true,
"maxTelemetryItemsPerSecond" : 5
}
}
}
| Property | Default | Description |
|---|---|---|
| isEnabled | true | Enables or disables sampling. |
| maxTelemetryItemsPerSecond | 5 | The threshold at which sampling begins. |
DocumentDB
Configuration settings for the Azure Cosmos DB trigger and bindings.
{
"documentDB": {
"connectionMode": "Gateway",
"protocol": "Https",
"leaseOptions": {
"leasePrefix": "prefix1"
}
}
}
| Property | Default | Description |
|---|---|---|
| GatewayMode | Gateway | The connection mode used by the function when connecting to the Azure Cosmos DB service. Options are Direct and Gateway |
| Protocol | Https | The connection protocol used by the function when connection to the Azure Cosmos DB service. Read here for an explanation of both modes |
| leasePrefix | n/a | Lease prefix to use across all functions in an app. |
durableTask
Configuration settings for Durable Functions.
Note
All major versions of Durable Functions are supported on all versions of the Azure Functions runtime. However, the schema of the host.json configuration differs slightly depending on the version of the Azure Functions runtime and the version of the Durable Functions extension that you use.
The following code provides two examples of durableTask settings in host.json: one for Durable Functions 2.x and one for Durable Functions 1.x. You can use both examples with Azure Functions 2.0 and 3.0. With Azure Functions 1.0, the available settings are the same, but the durableTask section of host.json is located in the root of the host.json configuration instead of being a field under extensions.
{
"extensions": {
"durableTask": {
"hubName": "MyTaskHub",
"defaultVersion": "1.0",
"versionMatchStrategy": "CurrentOrOlder",
"versionFailureStrategy": "Reject",
"storageProvider": {
"connectionStringName": "AzureWebJobsStorage",
"controlQueueBatchSize": 32,
"controlQueueBufferThreshold": 256,
"controlQueueVisibilityTimeout": "00:05:00",
"FetchLargeMessagesAutomatically": true,
"maxQueuePollingInterval": "00:00:30",
"partitionCount": 4,
"trackingStoreConnectionStringName": "TrackingStorage",
"trackingStoreNamePrefix": "DurableTask",
"useLegacyPartitionManagement": false,
"useTablePartitionManagement": true,
"workItemQueueVisibilityTimeout": "00:05:00",
"QueueClientMessageEncoding": "UTF8"
},
"tracing": {
"traceInputsAndOutputs": false,
"traceReplayEvents": false,
},
"notifications": {
"eventGrid": {
"topicEndpoint": "https://topic_name.westus2-1.eventgrid.azure.net/api/events",
"keySettingName": "EventGridKey",
"publishRetryCount": 3,
"publishRetryInterval": "00:00:30",
"publishEventTypes": [
"Started",
"Completed",
"Failed",
"Terminated"
]
}
},
"maxConcurrentActivityFunctions": 10,
"maxConcurrentOrchestratorFunctions": 10,
"maxConcurrentEntityFunctions": 10,
"extendedSessionsEnabled": false,
"extendedSessionIdleTimeoutInSeconds": 30,
"useAppLease": true,
"useGracefulShutdown": false,
"maxEntityOperationBatchSize": 50,
"maxOrchestrationActions": 100000,
"storeInputsInOrchestrationHistory": false
}
}
}
| Property | Default value | Description |
|---|---|---|
| hubName | TestHubName (DurableFunctionsHub in v1.x) | The name of the hub that stores the current state of a function app. Task hub names must start with a letter and consist of only letters and numbers. If you don't specify a name, the default value is used. Alternate task hub names can be used to isolate multiple Durable Functions applications from each other, even if they use the same storage back end. For more information, see Task hubs. |
| defaultVersion | The default version to assign to new orchestration instances. When you specify a version, new orchestration instances are permanently associated with this version value. This setting is used by the orchestration versioning feature to enable scenarios like zero-downtime deployments with breaking changes. You can use any string value for the version. | |
| versionMatchStrategy | CurrentOrOlder | A value that specifies how orchestration versions are matched when orchestrator functions are loaded. Valid values are None, Strict, and CurrentOrOlder. For detailed explanations, see Orchestration versioning. |
| versionFailureStrategy | Reject | A value that specifies what happens when an orchestration version doesn't match the current defaultVersion value. Valid values are Reject and Fail. For detailed explanations, see Orchestration versioning. |
| controlQueueBatchSize | 32 | The number of messages to pull from the control queue at a time. |
| controlQueueBufferThreshold | Consumption plan for Python: 32 Consumption plan for other languages: 128 Dedicated or Premium plan: 256 |
The number of control queue messages that can be buffered in memory at a time. When the specified number is reached, the dispatcher waits before dequeuing any other messages. In some situations, reducing this value can significantly reduce memory consumption. |
| partitionCount | 4 | The partition count for the control queue. This value must be a positive integer between 1 and 16. Changing this value requires configuring a new task hub. |
| controlQueueVisibilityTimeout | 00:05:00 | The visibility timeout of dequeued control queue messages in hh:mm:ss format. |
| workItemQueueVisibilityTimeout | 00:05:00 | The visibility timeout of dequeued work item queue messages in hh:mm:ss format. |
| FetchLargeMessagesAutomatically | true | A value that specifies whether to retrieve large messages in orchestration status queries. When this setting is true, large messages that exceed the queue size limit are retrieved. When this setting is false, a blob URL that points to each large message is retrieved. |
| maxConcurrentActivityFunctions | Consumption plan: 10 Dedicated or Premium plan: 10 times the number of processors on the current machine |
The maximum number of activity functions that can be processed concurrently on a single host instance. |
| maxConcurrentOrchestratorFunctions | Consumption plan: 5 Dedicated or Premium plan: 10 times the number of processors on the current machine |
The maximum number of orchestrator functions that can be processed concurrently on a single host instance. |
| maxConcurrentEntityFunctions | Consumption plan: 5 Dedicated or Premium plan: 10 times the number of processors on the current machine |
The maximum number of entity functions that can be processed concurrently on a single host instance. This setting is applicable only when you use the durable task scheduler. Otherwise, the maximum number of concurrent entity executions is limited to the maxConcurrentOrchestratorFunctions value. |
| maxQueuePollingInterval | 00:00:30 | The maximum control and work-item queue polling interval in hh:mm:ss format. Higher values can result in higher message processing latencies. Lower values can result in higher storage costs because of increased storage transactions. |
| maxOrchestrationActions | 100,000 | The maximum number of actions an orchestrator function can perform during a single execution cycle. |
| connectionName (v2.7.0 and later) connectionStringName (v2.x) azureStorageConnectionStringName (v1.x) |
AzureWebJobsStorage | The name of an app setting or setting collection that specifies how to connect to the underlying Azure Storage resources. When you provide a single app setting, it should be an Azure Storage connection string. |
| trackingStoreConnectionName (v2.7.0 and later) trackingStoreConnectionStringName |
The name of an app setting or setting collection that specifies how to connect to the History and Instances tables, which store the execution history and metadata about orchestration instances. When you provide a single app setting, it should be an Azure Storage connection string. If you don't specify a setting, the connectionStringName value (v2.x) or azureStorageConnectionStringName value (v1.x) connection is used. |
|
| trackingStoreNamePrefix | The prefix to use for the History and Instances tables when trackingStoreConnectionStringName is specified. If you don't specify a prefix, the default value of DurableTask is used. If trackingStoreConnectionStringName isn't specified, the History and Instances tables use the hubName value as their prefix, and the trackingStoreNamePrefix setting is ignored. |
|
| traceInputsAndOutputs | false | A value that indicates whether to trace the inputs and outputs of function calls. When function execution events are traced, the default behavior is to include the number of bytes in the serialized inputs and outputs for function calls. This behavior provides minimal information about the inputs and outputs so that it doesn't bloat the logs or inadvertently expose sensitive information. When this property is true, the entire contents of function inputs and outputs are logged. |
| traceReplayEvents | false | A value that indicates whether to write orchestration replay events to Application Insights. |
| logReplayEvents | false | A value that indicates whether to log replayed executions in application logs. |
| eventGridTopicEndpoint | The URL of an Azure Event Grid custom topic endpoint. When you set this property, orchestration lifecycle notification events are published to this endpoint. This property supports app settings resolution. | |
| eventGridKeySettingName | The name of the app setting that contains the key used for authenticating with the Event Grid custom topic at the EventGridTopicEndpoint URL. |
|
| eventGridPublishRetryCount | 0 | The number of times to retry if publishing to the Event Grid topic fails. |
| eventGridPublishRetryInterval | 00:05:00 | The Event Grid publish-retry interval in hh:mm:ss format. |
| eventGridPublishEventTypes | A list of event types to publish to Event Grid. If you don't specify any types, all event types are published. Allowed values include Started, Completed, Failed, and Terminated. |
|
| extendedSessionsEnabled | false | A value that specifies whether session orchestrator and entity function sessions are cached. |
| extendedSessionIdleTimeoutInSeconds | 30 | The number of seconds an idle orchestrator or entity function remains in memory before being unloaded. This setting is only used when the extendedSessionsEnabled setting is true. |
| useAppLease | true | A value that indicates whether apps must acquire an app-level blob lease before processing task hub messages. For more information, see Disaster recovery and geo-distribution in Durable Functions. This setting is available starting in v2.3.0. |
| useLegacyPartitionManagement | false | A value that specifies the type of partition management algorithm to use. When this setting is false, an algorithm is used that reduces the possibility of duplicate function execution when scaling out. This setting is available starting in v2.3.0. Setting this value to true isn't recommended. |
| useTablePartitionManagement | In v3.x: true In v2.x: false |
A value that specifies the type of partition management algorithm to use. When this setting is true, an algorithm is used that's designed to reduce costs for Azure Storage v2 accounts. This setting is available starting in WebJobs.Extensions.DurableTask v2.10.0. Using this setting with a managed identity requires WebJobs.Extensions.DurableTask v3.x or later, or Worker.Extensions.DurableTask v1.2.x or later. |
| useGracefulShutdown | false | (Preview) A value that indicates whether to shut down gracefully to reduce the chance of host shutdowns causing in-process function executions to fail. |
| maxEntityOperationBatchSize | Consumption plan: 50 Dedicated or Premium plan: 5,000 |
The maximum number of entity operations that are processed as a batch. If this value is 1, batching is disabled, and a separate function invocation processes each operation message. This setting is available starting in v2.6.1. |
| storeInputsInOrchestrationHistory | false | A value that specifies how to store inputs. When this setting is true, the Durable Task Framework saves activity inputs in the History table, and activity function inputs appear in orchestration history query results. |
| maxGrpcMessageSizeInBytes | 4,194,304 | An integer value that sets the maximum size, in bytes, of messages that the generic Remote Procedure Call (gRPC) client can receive. The implementation of DurableTaskClient uses the gRPC client to manage orchestration instances. This setting applies to Durable Functions .NET isolated worker and Java apps. |
| grpcHttpClientTimeout | 00:01:40 | The timeout in hh:mm:ss format for the HTTP client used by the gRPC client in Durable Functions. The client is currently supported for .NET isolated worker apps (.NET 6 and later versions) and for Java apps. |
| QueueClientMessageEncoding | UTF8 | The encoding strategy for Azure Queue Storage messages. Valid strategies are Unicode Transformation Format–8-bit (UTF8) and Base64. This setting applies when you use Microsoft.Azure.WebJobs.Extensions.DurableTask 3.4.0 or later, or Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.7.0 or later. |
Many of these settings are for optimizing performance. For more information, see Performance and scale.
eventHub
Configuration settings for Event Hub triggers and bindings.
functions
A list of functions that the job host runs. An empty array means run all functions. Intended for use only when running locally. In function apps in Azure, you should instead follow the steps in How to disable functions in Azure Functions to disable specific functions rather than using this setting.
{
"functions": [ "QueueProcessor", "GitHubWebHook" ]
}
functionTimeout
Indicates the timeout duration for all functions. In a serverless Consumption plan, the valid range is from 1 second to 10 minutes, and the default value is 5 minutes. In an App Service plan, there is no overall limit and the default is null, which indicates no timeout.
{
"functionTimeout": "00:05:00"
}
healthMonitor
Configuration settings for Host health monitor.
{
"healthMonitor": {
"enabled": true,
"healthCheckInterval": "00:00:10",
"healthCheckWindow": "00:02:00",
"healthCheckThreshold": 6,
"counterThreshold": 0.80
}
}
| Property | Default | Description |
|---|---|---|
| enabled | true | Specifies whether the feature is enabled. |
| healthCheckInterval | 10 seconds | The time interval between the periodic background health checks. |
| healthCheckWindow | 2 minutes | A sliding time window used with the healthCheckThreshold setting. |
| healthCheckThreshold | 6 | Maximum number of times the health check can fail before a host recycle is initiated. |
| counterThreshold | 0.80 | The threshold at which a performance counter will be considered unhealthy. |
http
Configuration settings for http triggers and bindings.
{
"http": {
"routePrefix": "api",
"maxOutstandingRequests": 200,
"maxConcurrentRequests": 100,
"dynamicThrottlesEnabled": true
}
}
| Property | Default | Description |
|---|---|---|
| dynamicThrottlesEnabled | false | When enabled, this setting causes the request processing pipeline to periodically check system performance counters like connections/threads/processes/memory/cpu/etc. and if any of those counters are over a built-in high threshold (80%), requests are rejected with a 429 "Too Busy" response until the counter(s) return to normal levels. |
| maxConcurrentRequests | unbounded (-1) |
The maximum number of HTTP functions that will be executed in parallel. This allows you to control concurrency, which can help manage resource utilization. For example, you might have an HTTP function that uses a lot of system resources (memory/cpu/sockets) such that it causes issues when concurrency is too high. Or you might have a function that makes outbound requests to a third party service, and those calls need to be rate limited. In these cases, applying a throttle here can help. |
| maxOutstandingRequests | unbounded (-1) |
The maximum number of outstanding requests that are held at any given time. This limit includes requests that are queued but have not started executing, and any in progress executions. Any incoming requests over this limit are rejected with a 429 "Too Busy" response. That allows callers to employ time-based retry strategies, and also helps you to control maximum request latencies. This only controls queuing that occurs within the script host execution path. Other queues such as the ASP.NET request queue will still be in effect and unaffected by this setting. |
| routePrefix | api | The route prefix that applies to all routes. Use an empty string to remove the default prefix. |
id
The unique ID for a job host. Can be a lower case GUID with dashes removed. Required when running locally. When running in Azure, we recommend that you not set an ID value. An ID is generated automatically in Azure when id is omitted.
If you share a Storage account across multiple function apps, make sure that each function app has a different id. You can omit the id property or manually set each function app's id to a different value. The timer trigger uses a storage lock to ensure that there will be only one timer instance when a function app scales out to multiple instances. If two function apps share the same id and each uses a timer trigger, only one timer runs.
{
"id": "9f4ea53c5136457d883d685e57164f08"
}
logger
Controls filtering for logs written by an ILogger object or by context.log.
{
"logger": {
"categoryFilter": {
"defaultLevel": "Information",
"categoryLevels": {
"Host": "Error",
"Function": "Error",
"Host.Aggregator": "Information"
}
}
}
}
| Property | Default | Description |
|---|---|---|
| categoryFilter | n/a | Specifies filtering by category |
| defaultLevel | Information | For any categories not specified in the categoryLevels array, send logs at this level and above to Application Insights. |
| categoryLevels | n/a | An array of categories that specifies the minimum log level to send to Application Insights for each category. The category specified here controls all categories that begin with the same value, and longer values take precedence. In the preceding sample host.json file, all categories that begin with "Host.Aggregator" log at Information level. All other categories that begin with "Host", such as "Host.Executor", log at Error level. |
queues
Configuration settings for Storage queue triggers and bindings.
{
"queues": {
"maxPollingInterval": 2000,
"visibilityTimeout" : "00:00:30",
"batchSize": 16,
"maxDequeueCount": 5,
"newBatchThreshold": 8
}
}
| Property | Default | Description |
|---|---|---|
| maxPollingInterval | 60000 | The maximum interval in milliseconds between queue polls. |
| visibilityTimeout | 0 | The time interval between retries when processing of a message fails. |
| batchSize | 16 | The number of queue messages that the Functions runtime retrieves simultaneously and processes in parallel. When the number being processed gets down to the newBatchThreshold, the runtime gets another batch and starts processing those messages. So the maximum number of concurrent messages being processed per function is batchSize plus newBatchThreshold. This limit applies separately to each queue-triggered function. If you want to avoid parallel execution for messages received on one queue, you can set batchSize to 1. However, this setting eliminates concurrency only so long as your function app runs on a single virtual machine (VM). If the function app scales out to multiple VMs, each VM could run one instance of each queue-triggered function.The maximum batchSize is 32. |
| maxDequeueCount | 5 | The number of times to try processing a message before moving it to the poison queue. |
| newBatchThreshold | batchSize/2 | Whenever the number of messages being processed concurrently gets down to this number, the runtime retrieves another batch. |
SendGrid
Configuration setting for the SendGrind output binding
{
"sendGrid": {
"from": "Contoso Group <[email protected]>"
}
}
| Property | Default | Description |
|---|---|---|
| from | n/a | The sender's email address across all functions. |
serviceBus
Configuration setting for Service Bus triggers and bindings.
{
"serviceBus": {
"maxConcurrentCalls": 16,
"prefetchCount": 100,
"autoRenewTimeout": "00:05:00",
"autoComplete": true
}
}
| Property | Default | Description |
|---|---|---|
| maxConcurrentCalls | 16 | The maximum number of concurrent calls to the callback that the message pump should initiate. By default, the Functions runtime processes multiple messages concurrently. To direct the runtime to process only a single queue or topic message at a time, set maxConcurrentCalls to 1. |
| prefetchCount | n/a | The default PrefetchCount that will be used by the underlying ServiceBusReceiver. |
| autoRenewTimeout | 00:05:00 | The maximum duration within which the message lock will be renewed automatically. |
| autoComplete | true | When true, the trigger completes the message processing automatically on successful execution of the operation. When false, it is the responsibility of the function to complete the message before returning. |
singleton
Configuration settings for Singleton lock behavior. For more information, see GitHub issue about singleton support.
{
"singleton": {
"lockPeriod": "00:00:15",
"listenerLockPeriod": "00:01:00",
"listenerLockRecoveryPollingInterval": "00:01:00",
"lockAcquisitionTimeout": "00:01:00",
"lockAcquisitionPollingInterval": "00:00:03"
}
}
| Property | Default | Description |
|---|---|---|
| lockPeriod | 00:00:15 | The period that function level locks are taken for. The locks auto-renew. |
| listenerLockPeriod | 00:01:00 | The period that listener locks are taken for. |
| listenerLockRecoveryPollingInterval | 00:01:00 | The time interval used for listener lock recovery if a listener lock couldn't be acquired on startup. |
| lockAcquisitionTimeout | 00:01:00 | The maximum amount of time the runtime tries to acquire a lock. |
| lockAcquisitionPollingInterval | n/a | The interval between lock acquisition attempts. |
tracing
Version 1.x
Configuration settings for logs that you create by using a TraceWriter object. To learn more, see [C# Logging].
{
"tracing": {
"consoleLevel": "verbose",
"fileLoggingMode": "debugOnly"
}
}
| Property | Default | Description |
|---|---|---|
| consoleLevel | info | The tracing level for console logging. Options are: off, error, warning, info, and verbose. |
| fileLoggingMode | debugOnly | The tracing level for file logging. Options are never, always, debugOnly. |
watchDirectories
A set of shared code directories that should be monitored for changes. Ensures that when code in these directories is changed, the changes are picked up by your functions.
{
"watchDirectories": [ "Shared" ]
}