host.json Reference

The host.json file contains global configuration options that affect all functions in a function app. This file is located in the root directory of your function app.

Configuration Settings

The host.json file supports various settings to control the behavior of your Azure Functions host.

version

Specifies the schema version of the host.json file. It's recommended to use the latest supported version.


{
  "version": "2.0",
  "logging": {
    // ...
  }
}
            

logging

Configures the logging behavior for your function app.

applicationInsights

Enables and configures logging to Azure Application Insights.


{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  }
}
            

logLevel

Sets the minimum log level for the Functions host. Possible values are Trace, Debug, Information, Warning, Error, Critical, None.


{
  "version": "2.0",
  "logging": {
    "logLevel": {
      "default": "Information",
      "Host.Aggregator": "Information"
    }
  }
}
            

extensionBundle

Manages the binding extensions for your function app. This is often used to automatically include common binding extensions.


{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.*, 4.0.0)"
  }
}
            

For version 3.x and later, it's recommended to use the extensionBundle to manage extensions.

functionTimeout

Specifies the default timeout for functions that don't have an explicit timeout configured. Format is a string representing a TimeSpan (e.g., "00:05:00" for 5 minutes).


{
  "version": "2.0",
  "functionTimeout": "00:10:00"
}
            

maxConcurrentRequests

Controls the maximum number of concurrent HTTP requests that can be processed by the Functions host. This setting is particularly relevant for HTTP-triggered functions.


{
  "version": "2.0",
  "maxConcurrentRequests": 100
}
            

aggregator

Configures metrics aggregation. Useful for monitoring performance.


{
  "version": "2.0",
  "aggregator": {
    "batchSize": 1000,
    "flushInterval": "00:00:30"
  }
}
            

Example host.json

Here's a comprehensive example demonstrating common settings:


{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "default": "Information",
      "Host.Aggregator": "Information",
      "Host.General": "Trace"
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.*, 4.0.0)"
  },
  "functionTimeout": "00:08:00",
  "maxConcurrentRequests": 200,
  "aggregator": {
    "batchSize": 500,
    "flushInterval": "00:01:00"
  }
}
            

Note on Versioning

The structure and available options in host.json can vary between major versions of Azure Functions. Always refer to the documentation specific to your Functions runtime version.

Understanding and configuring host.json is crucial for optimizing the performance, reliability, and monitoring of your Azure Functions applications.

Further Reading