Skip to content

Host IDs

Mathew Charles edited this page Sep 30, 2021 · 16 revisions

Overview

The Functions Host uses a Host ID to uniquely identify a particular Function App. By default, the ID is auto-generated from the Function App name, by taking the first 32 characters. In advanced scenarios, the ID can also be specified manually via App Settings (see below). This Host ID is used by the platform to store per-app correlated control/tracking information in the storage account.

Host ID Collisions

If you have multiple Function Apps sharing a single storage account and they're each using the same Host ID, that can result in a Host ID collision. When multiple apps are using the same Host ID (a collision), this can result incorrect behaviors. For example, some triggers like TimerTrigger/BlobTrigger store tracking info by HostID and can behave incorrectly when multiple apps use the same ID.

In Functions v3 we added detection for this situation and a warning will be logged. In Functions v4 when this situation is detected an error will be logged, and the host will shut down (hard failure).

Options for addressing collisions:

  1. Point your app at a different storage account.
  2. Rename your app so something less than 32 characters in length. This will change the computed Host ID for the app and remove the collision.
  3. Provide an explicit Host ID for your app(s) so they don't conflict anymore (see below).
  4. You can disable this error via the FUNCTIONS_HOSTID_CHECK_LEVEL app setting. Only do this if none of the options above are possible for you. Possible values for this setting are "Warning" and "Error".

Keep in mind that pointing an existing app to a new storage account, or changing the HostID or name of the function app can impact function processing. For example, BlobTrigger tracks whether it's processed individual blobs by writing "receipts" under a HostID path in storage. If the HostID changes or you point to a new storage account, that can lead to blobs being reprocessed. For a new app that hasn't processed work yet, this won't be a problem.

Host ID Override

You can specify an explicit Host ID for your app via app settings:

  • AzureFunctionsWebHost__hostId (Windows and Linux)
  • AzureFunctionsWebHost:hostId (Windows only)

The value for the ID must be are under 32 characters in length. Other restrictions the value must satisfy are here. An easy way to generate an ID would be to take a GUID, remove the dashes and make it lower case, e.g. 1835D7B5-5C98-4790-815D-072CC94C6F71 => 1835d7b55c984790815d072cc94c6f71

Learn

Azure Functions Basics

Advanced Concepts

Dotnet Functions

Java Functions

Node.js Functions

Python Functions

Host API's

Bindings

V2 Runtime

Contribute

Functions host

Language workers

Get Help

Other

Clone this wiki locally