Step 1: Create an Application Insights resource
Creating an Application Insights workspace-based resource us a prerequisite.
Step 2: Copy the connection string
A connection string identifies the resource that you want to associate with your telemetry data. It also allows you to modify the endpoints that your resource will use as a destination for your telemetry. You'll need to copy the connection string and add it to your application's code or to an environment variable.
Step 3: Configure the Application Insights SDK in the app
The Application Insights SDK for ASP.NET Core can monitor your applications no matter where or how they run.
Install the Application Insights SDK NuGet package for ASP.NET Core.
Reference:
https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core