An Azure service that provides an event-driven serverless compute platform.
Hello Vigneshwaran Balu (EXT),
your .NET 8 isolated Function is sending the exact same telemetry twice into the same Log Analytics workspace—once from the Functions host and once from your worker/App Insights pipeline (or once via App Insights→LA and again via a resource Diagnostic Setting). Because both pipelines stamp logs with the same OperationId and timestamp, you see perfect duplicates.
Here’s how to eliminate the dupe:
Pick a single ingestion path
- Host-only integration (the default): • Remove any direct SDK calls (e.g.
AddApplicationInsightsTelemetryWorkerService()/ConfigureFunctionsApplicationInsights()in Program.cs). • Keep your Application Insights connection string or instrumentation key in the Function App settings.- Worker-only integration (direct SDK in isolated process): • In your Function App’s Application Settings, remove the
APPINSIGHTS_INSTRUMENTATIONKEYor portal-configured AI connection so the host doesn’t auto-stream. • Keep yourAddApplicationInsightsTelemetryWorkerService()+ConfigureFunctionsApplicationInsights()calls in Program.cs.- Diagnostics-only (Azure Monitor Diagnostic Setting): • If you’re using the Function App’s “Diagnostics” blade to send FunctionAppLogs into your workspace, disable that setting and rely on the above AI pipeline instead.
- Ensure you’re not setting both `APPINSIGHTS_INSTRUMENTATIONKEY` *and* `APPLICATIONINSIGHTS_CONNECTION_STRING`. Only the connection string is preferred. - Confirm you don’t have a Diagnostic Setting on the Function resource sending *FunctionAppLogs* into the same workspace that App Insights is already feeding. Validate it went away Run a quick Kusto query in Log Analytics to find any ops with more than one record per minute: ```sql union requests, traces
- Worker-only integration (direct SDK in isolated process): • In your Function App’s Application Settings, remove the
| summarize cnt = count() by operation_Id, bin(timestamp, 1m) | where cnt > 1 ```
If you only see `cnt == 1`, you’ve successfully removed the duplicate stream.
Follow-up questions if you’re not sure:
- Do you have any Azure Monitor Diagnostic Settings on the Function App resource sending FunctionAppLogs/FunctionAppMetrics to the workspace?
- Did you manually wire up Application Insights in
Program.cs(withAddApplicationInsightsTelemetryWorkerService()/ConfigureFunctionsApplicationInsights()) and also set the AI key/connection string in App Settings? - Which Functions runtime version are you on, and what hosting plan (Consumption, Premium, Dedicated)?
That should get you back to a single, accurate set of invocation logs.
Reference docs: • Application Insights logs missing or incorrect: https://learn.microsoft.com/troubleshoot/azure/azure-functions/monitoring/functions-monitoring-appinsightslogs • .NET isolated process + App Insights guide: https://learn.microsoft.com/azure/azure-functions/dotnet-isolated-process-guide?tabs=ihostapplicationbuilder%2Ccode%2Clinux#application-insights • Troubleshoot Azure Function App Log Analytics: https://learn.microsoft.com/azure/azure-functions/monitor-functions-reference#supported-resource-logs-for-microsoftwebsites • Application Insights Duplicate logs deep dive: https://supportability.visualstudio.com/AzureAppService/_wiki/wikis/AzureAppService/1215633/Azure Function App/Monitoring resources, using metrics, logs and alerts/Application Insights/Application Insights Duplicate logs • Troubleshooting duplicate records in Azure Monitor Logs: https://learn.microsoft.com/azure/azure-monitor/logs/get-started-queries#why-am-i-seeing-duplicate-records-in-azure-monitor-logs
Please accept as answer and do a Thumbs-up to upvote this response if you are satisfied with the community help. Your upvote will be beneficial for the community users facing similar issues.