User id null in application insight

Abhay Gupta 71 Reputation points
2022-03-31T17:08:34.97+00:00

Hi

We have an Azure function with http trigger and for logging we are using application insight.

In application insight we are seeing the userid column always null. Can you please help us understand how is this populated? Is it reading from some header that we can send to have it populated?

Thanks

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,037 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,678 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lohith GN 511 Reputation points
    2022-04-05T01:25:59.057+00:00

    If you don't use App Insights for UI tracking i.e. whatever front end you have, you have not used App Insights integration in your front end - there is no way App Insights will know who is the logged-in user.

    Usually, for backend i.e. server side tracking - there are a couple of ways we use App Insights. Typically in my architectures - I will have App Insights set up to sniff the traffic that happening within the server + code level integration to log exceptions. The implicit way will not track any code-level exceptions. For that, you need to integrate with App Insights SDK.

    From your answer, I am assuming you are using App Insights on your server-side. And on the server side, you want to track which user has performed what action. For this, you will need to explicitly log app insights tracking with the user information you have on your server. Maybe you have an oauth token authentication or cookie-based authentication - extract whatever info you need and log it to app insights.

    0 comments No comments