Issues you may meet when upgrading Azure function app to V4
Published Apr 20 2022 07:27 PM 23.8K Views

This blog will talk about some common issues you may meet when you try to upgrade your Azure function from older runtime version to newer (eg. ~4) and the causes/resolutions.


Public Doc:

Blog Function v4 VS v3:

Migrate from 3.x to 4.x:

Migrate from 2.x to 3.x:

Known issues:


[Issue 1] Runtime warning message on portal

To upgrade your function App, you set the FUNCTIONS_EXTENSION_VERSION to "~4".


You may observe below warning message and the runtime version got set to "custom" rather than "~4".

"Your app is pinned to an unsupported runtime version for 'xxx'. For better performance, we recommend using one of our supported versions instead: xxx."




1. Access to check the runtime stack version



2. If FUNCTIONS_WORKER_RUNTIME is set to "dotnet", check the value of "netFrameworkVersion".

If set to "powershell", check "powerShellVersion". Same for other programming languages.


3. Refer to below table, if for function v4, "netFrameworkVersion" is "v4.0" or "powerShellVersion" is "~6", those language stack versions are unsupported in V4, you'll then see the warning message on portal and runtime got set to "custom" automatically.







GA (.NET Framework 4.8)

GA (.NET Core 2.11)

GA (.NET Core 3.1)

GA (.NET 5.0)

GA (.NET 6.0)


GA (Node.js 6)

GA (Node.js 10 & 8)

GA (Node.js 14, 12, & 10)

GA (Node.js 14)

GA (Node.js 16)


GA (.NET Framework 4.8)

GA (.NET Core 2.11)

GA (.NET Core 3.1)

GA (.NET 6.0)



GA (Java 8)

GA (Java 11 & 8)

GA (Java 11 & 8)



GA (PowerShell Core 6)

GA (PowerShell 7.0 & Core 6)

GA (PowerShell 7.0)



GA (Python 3.7 & 3.6)

GA (Python 3.9, 3.8, 3.7, & 3.6)

GA (Python 3.9, 3.8, 3.7)







Soft reminder:

For .NET function app,  function runtime

  • [~2] your app will be automatically upgraded to run on .NET Core 3.1, which is a long-term support version of .NET Core 3. (Even if it mention .NET Core is only supported for 3.x.
  • [~2.0] You could choose to pin to "~2.0" to stay with .NET Core 2.2. Ref


Your V3 function app's netFrameWorkVersion has been on .NET 4.0.  Function V4 runtime requires .NET 6.0. The platform didn’t update it automatically, this is to avoid breaking customer’s applications who uses any method/type unsupported in .NET 6.0.

We'll leave this .NET version upgrade action(updating "netFrameworkVersion") to customers, and with the warning message to remind that the function v4 will need .NET 6.0. You could then decide if the function is ready to be upgraded to v4 from older runtime version.



For dotnet app


  • Use Azure CLI cmds to update "netFrameworkVersion" in app config for app or app slots:


az functionapp config set --net-framework-version v6.0 -n <APP_NAME> -g <RESOURCE_GROUP_NAME>
az functionapp config set --net-framework-version v6.0 -n <APP_NAME> -g <RESOURCE_GROUP_NAME> --slot <SLOT_NAME>​



  • Or use resource explorer -> find web app -> config -> web -> netFrameworkVersion update to V6.0.



For other languages


  • You could update the language version on portal too



Also please make sure your local project is compatible with your selected language version.



Actions needed for upgrading to V4


[Issue 2] Function App returns 503 Server unavailable

After upgrading your function App to "~4", the function app started to give 503 errors.



503 server error for function app may indicate a host related issue such as "host failed to start up". If your function app enables app insight, you could run below query to get more error details:


| where severityLevel >= 2





In some cases, we find the error which caused host to fail as below:


Microsoft.Azure.WebJobs.Script.HostInitializationException : One or more loaded extensions do not meet the minimum requirements. For more information see

ExtensionStartupType EventHubsWebJobsStartup from assembly 'Microsoft.Azure.WebJobs.EventHubs, Version=, Culture=neutral, PublicKeyToken=xxx' does not meet the required minimum version of Update your NuGet package reference for Microsoft.Azure.WebJobs.Extensions.EventHubs to 4.3.0 or later.

ExtensionStartupType CosmosDBWebJobsStartup from assembly 'Microsoft.Azure.WebJobs.Extensions.CosmosDB, Version=, Culture=neutral, PublicKeyToken=xxxx' does not meet the required minimum version of Update your NuGet package reference for Microsoft.Azure.WebJobs.Extensions.CosmosDB to 3.0.9 or later.



Function V4 required a minimum version for supported extensions. The functions host will enforce the proposed minimum versions in the table below. If an older version of one of the following extensions is present, the host will throw an error specifying the minimum required version and fail to start.




For dotnet app


Please do a set of NuGet updates to get the supported extensions installed for affected extensions.


For other languages


Please upgrade to extension bundle version 2.x or later



Function V4 required a minimum version for supported extensions:


[Issue 3] Function v4 fallback to V2

Your function app is built with V4 runtime locally, but when you try to deploy it via Cloud Shell, you observe below warning. The deployment completed but app responded 502/503. Your app's still using runtime V2 rather than V4.

"You're trying to publish to a non-v2 function app from v2 tooling.
You can pass --force to force update the app to v2, or switch to v1 or v3 tooling for publishing




The publish tooling Azure  Function Core tools version needs to be aligned with function app's runtime version.

  • Develop app v3 -> 3.x Core Tools
  • Develop app v4 -> 4.x Core Tools

There're other changes needed for VS Code.



 1.   Upgrade function app runtime version via Azure CLI or portal app setting change:


az functionapp config appsettings set --name <FUNCTION_APP> \
--resource-group <RESOURCE_GROUP> \


 2.  Upgrade function core tool to version 4.x.


npm i -g azure-functions-core-tools@4 --unsafe-perm true




View and update current runtime version:


[Issue 4] Function v4 host failed to start up due to host ID collision

Your function app is upgraded to V4 runtime, you migrated function app to use corresponding language version and updated with the latest SDK such as Azure.Messasing.ServiceBus library too. But the app has below issues:

  1. 500/503 Service is unavailable
  2. You observed error in App insight logs/diagnose and solve problem -> Function App down or reporting errors

 "A collision for Host ID 'xxxx' was detected in the configured storage account. For more information, see"




Your function app name has more than 32 characters and it's using a storage account shared with other function apps.

  • Starting with version 3.x of the Functions runtime, host ID collision is detected and a warning is logged.
  • In version 4.x, an error is logged and the host is stopped, resulting in a hard failure to prevent the host from starting. Ref for more details.

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. This ID is then used when storing per-app correlation and tracking information in the linked storage account. When you have function apps with names longer than 32 characters and when the first 32 characters are identical, this truncation can result in duplicate host ID values. When two function apps with identical host IDs use the same storage account, you may get a host ID collision because stored data can't be uniquely linked to the correct function app.

To prevent this kind of issue, in version 4.x, host ID collision is detected an error is logged, and the host is shut down (hard failure).



You may choose one of below options:

  1. Point your app at a different storage account. [Best practice]
  2. Rename your app to something less than 32 characters in length. This will change the computed Host ID for the app and remove the collision. [Most recommended]
  3. Provide an explicit Host ID for your app(s) so they don't conflict anymore, via app setting AzureFunctionsWebHost__hostId.
  4. In the case of v4 hard failure, 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". [Last choice to bypass the warning]



For the 3rd option to customize hostID using app setting AzureFunctionsWebHost__hostId, you might seeing warning in Azure portal or logs saying that it is not recommended to overwrite it, such as "Host id explicitly set in configuration. This is not a recommended configuration and may lead to unexpected behavior."

No worries for the warning. If the you’ve done this in accordance with this guidance, the app will be fine. This is one of the workaround options. PG has emitted this warning when the host ID is explicitly set because it’s not the default configuration. For example, if application slots are used, you need to set different hostID values for those slots.

If the condition allows, the most recommended resolution will be to shorten the app names, but not required.


Public wiki regarding host collision:

App setting AzureFunctionsWebHost__hostId:

Function host reminder public documentation:

Github discussion regarding host collision:



Most of above actions are mentioned in doc such as

  • Update app setting
  • Update .net framework version
  • Update nuget package reference version
  • Update Azure Core Tools Version

Nowadays, migration across different runtime version is safer and more convenient, and doesn't require significant code change. Just need a little bit more attention to the related tools/packages upgrade, then all will be good!


Feel free to comment below if you've any other questions!

1 Comment
Version history
Last update:
‎Jul 06 2022 08:15 PM
Updated by: