I'm trying to get application insights to work in azure batch job/task while running through a .net core 3.1 console application.
When I run the console app through Visual Studio debug or directly on a node in the batch pool, I get all the appropriate telemetry and logs. However when I setup a task to run the console app I'm not getting any data in application insights.
Guides I looked through:
- https://docs.microsoft.com/en-us/azure/batch/monitor-application-insights
- https://docs.microsoft.com/en-us/azure/azure-monitor/app/worker-service
- https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core
Is there anyway to get the AppInsights data when running the console app through the task?
edit I have added a TelemetryClient.Flush and Thread.sleep to the end of the process. I can now see explicit calls to TelemetryClient.TrackedEvents but I'm not getting any dependency information, such as SQL call, api calls etc.This only happens to calls made inside a Task. If the console application gets called through a regular command line all information is visible.