APPLICATIONINSIGHTS_CONNECTION_STRING or APPINSIGHTS_INSTRUMENTATIONKEY is defined but the Application Insights Extension is not installed
Issue
Azure functions v4.0 .NET 6 based isolated worker application doesn't start because of the following issue:
Microsoft.Azure.WebJobs.Script: APPLICATIONINSIGHTS_CONNECTION_STRING or APPINSIGHTS_INSTRUMENTATIONKEY is defined but the Application Insights Extension is not installed. Please install the Application Insights Extension. See https://aka.ms/func-applicationinsights-extension for more details.
Cause
As of Azure Functions host version 4.0.0.16394, Application Insights is no longer included by default. It is now available as a separate extension.
More details: [Azure Functions][V4] Azure Functions 4.0.0-preview.5.16714 (breaking changes) #348
[Azure Functions] [V4] Application Insights is now available as an extension (breaking change) #346
Resolution
For in-process .NET apps, install version 1.0.0-preview4 or later of the Microsoft.Azure.WebJobs.Extensions.ApplicationInsights extension package.
For isolated .NET apps, install version 1.0.0-preview4 or later of the Microsoft.Azure.Functions.Worker.Extensions.ApplicationInsights extension package. Also, make sure that the Microsoft.Azure.Functions.Worker and Microsoft.Azure.Functions.Worker.Sdk are updated to the latest versions.
If you cannot find find the extension package, you can directly add it into your project reference:
Local debug screenshot: