CodePudding user response:
- By default, SQL Collection is set to off. We need to enable it in the Azure Portal.
- To get the full SQL Query, we need to enable the
SQL Commands
in our deployedApp Service
=>Application Insights
.
- Add the below line of code in
Program.cs
file, if it is.NET Core
Applications.
builder.Services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module.EnableSqlCommandTextInstrumentation = true; });
- If it is
.NET Framework
Application, add the below line inTelemetryModules
section inApplicationInsights.config
file (which is generated when we add Application Insights in Visual Studio.
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">,
<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>
</Add>