Q:

How to get user_authenticatedID in Application Insights for Azure Functions App?

I have been going through several different resources to add this but it does not seem to be working. I would like to record the authenticated user as a request is made to my Azure function. I can obtain the authenticated user from the claims principal. I followed the docs to inject the Telemetry Configuration and instantiate the TelemetryClient with the configuration. I check the claims to see if they are null and if not I set TelemetryClient.Context.User.AuthenticatedId = claimsPrincipal.Identity.Name. However in the logs I am unable to see the field being populated. 
class{
   private readonly TelemetryClient tc;
   public classConstructor(TelemetryConfiguration config){
      tc = new TelemetryClient(congig)
   }

    public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = 
    "user/session")] HttpRequest req, ILogger log, ClaimsPrincipal claimsPrincipal){

            //null check on claimsprincipal
            tc.Context.User.UserAuthenticatedId = claimsPrincipal?.Identity?.Name;

   }

startup class{
      builder.Services.AddSingleton<TelemetryConfiguration>(provider =>
           var telemetryConfiguration = new TelemetryConfiguration();
           telemetryConfiguration.instrumentationKey = "key"
           return telemetryConfiguration;
}

A:

I'm not sure where you want to show TelemetryClient.Context.User.AuthenticatedId. 
If you want to see it in Logs, you need to add:
log.LogInformation(tc.Context.User.AuthenticatedUserId);

If you want to see it in application insights, you need to use TrackTrace or TrackEvent:
tc.TrackEvent("---------track-event" + tc.Context.User.AuthenticatedUserId);
tc.TrackTrace("---------track-trace" + tc.Context.User.AuthenticatedUserId);

Then you can see them in application insights(shown as below screenshot)

Here provide my code for your reference:
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
using System.Security.Claims;
using ikvm.runtime;
using Microsoft.Azure.WebJobs.Hosting;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;

namespace FunctionApp6
{
    public class Function1
    {
        private readonly TelemetryClient tc;

        public Function1(TelemetryConfiguration config)
        {
            this.tc = new TelemetryClient(config);
        }

        [FunctionName("Function1")]
        public async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ClaimsPrincipal claimsPrincipal)
        {

            tc.Context.User.AuthenticatedUserId = "---userid---";

            log.LogInformation(tc.Context.User.AuthenticatedUserId);
            tc.TrackEvent("---------track-event" + tc.Context.User.AuthenticatedUserId);
            tc.TrackTrace("---------track-trace" + tc.Context.User.AuthenticatedUserId);

            string responseMessage = "This HTTP triggered function executed successfully";

            return new OkObjectResult(responseMessage);
        }

        public class MyStartup : IWebJobsStartup
        {
            public void Configure(IWebJobsBuilder builder)
            {
                var configDescriptor = builder.Services.SingleOrDefault(tc => tc.ServiceType == typeof(TelemetryConfiguration));
                if (configDescriptor?.ImplementationFactory != null)
                {
                    var implFactory = configDescriptor.ImplementationFactory;
                    builder.Services.Remove(configDescriptor);
                    builder.Services.AddSingleton(provider =>
                    {
                        if (implFactory.Invoke(provider) is TelemetryConfiguration config)
                        {
                            var newConfig = TelemetryConfiguration.CreateDefault();
                            newConfig.ApplicationIdProvider = config.ApplicationIdProvider;
                            newConfig.InstrumentationKey = config.InstrumentationKey;

                            return newConfig;
                        }
                        return null;
                    });
                }
            }
        }
    }
}

