diff --git a/docs/core/diagnostics/snippets/OTLP-Example/csharp/Program.cs b/docs/core/diagnostics/snippets/OTLP-Example/csharp/Program.cs index b8b67efe33bbb..c6007c442ca2a 100644 --- a/docs/core/diagnostics/snippets/OTLP-Example/csharp/Program.cs +++ b/docs/core/diagnostics/snippets/OTLP-Example/csharp/Program.cs @@ -62,7 +62,8 @@ // // -if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"])) +if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"] + ?? builder.Configuration["AzureMonitor:ConnectionString"])) { otel.UseAzureMonitor(); }