Azure Functions Host.json Configuration

The host.json file is used to configure global settings for your Azure Functions host. It allows you to control aspects like logging, HTTP settings, and distributed tracing.

Schema Overview

The host.json file follows a specific schema. Here's a common structure and an explanation of its key properties:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "default": "Information",
      "Host.Results": "Error",
      "Function.MyFunctionName": "Debug"
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  },
  "http": {
    "routePrefix": "api",
    "maxOutstandingRequests": 200,
    "maxConcurrentRequests": 100
  },
  "singleton": {
    "lockPeriod": "00:00:15",
    "graceTime": "00:00:10",
    "retryTimeout": "00:00:05"
  },
  "concurrency": {
    "dynamicConcurrencyEnabled": true
  },
  "functions": {
    "MyFunctionName": {
      "scriptFile": "run.py",
      "entryPoint": "main",
      "timeout": "00:05:00",
      "trigger": null,
      "disabled": false
    }
  },
  "customHandler": {
    "description": {
      "defaultExecutablePath": "handler.sh",
      "workingDirectory": "",
      "arguments": []
    }
  }
}

Key Configuration Properties

version

Specifies the version of the host.json schema. The recommended value is "2.0".

logging

Configures logging behavior. This section is crucial for monitoring your functions.

extensionBundle

Defines which extension bundles to use. Bundles provide pre-packaged bindings and extensions.

http

Settings for the HTTP trigger.

singleton

Configuration for singleton execution, often used with durable functions or specific triggers that require exclusive processing.

concurrency

Settings related to function concurrency and scaling.

functions

Allows you to configure settings on a per-function basis. This overrides global settings for specific functions.

customHandler

Used for custom handlers, where the execution logic is external to the Functions host.

Tip: For detailed information on specific bindings and their configuration within host.json, please refer to the official Azure Functions documentation. This file is powerful and central to customizing your function app's behavior.