Hi Oussama Dhouioui,
Thank you for reaching out to Microsoft Q & A forum.
To disable auto instrumentation in Application Insights when using Bicep, there's no direct property for this in the Bicep schema. However, you can manage this in the following ways:
1.Disable Auto Instrumentation in App Service:
Auto-instrumentation can be disabled by adjusting the APPINSIGHTS INSTRUMENTATIONKEY environment variable in the App Service settings, ensuring that the automatic tracking isn’t enabled.
2.Custom Telemetry:
When using custom telemetry, ensure that automatic tracking for dependencies, requests, and exceptions is disabled within the SDK configuration. This will prevent any duplication of logs.
3.Bicep Template Example:
Below is a sample Bicep template for deploying Application Insights:
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
name: 'myAppInsights'
location: 'East US'
kind: 'web'
properties: {
Application_Type: 'web'
RetentionInDays: 30
SamplingPercentage: 100
}
}
By following these steps, you can configure your Application Insights without enabling auto-instrumentation, ensuring that your custom telemetry remains the primary source for monitoring.
If the issue persists, please share the relevant code snippets so we can provide more targeted assistance.
If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.