Skip to content

Commit 235e62e

Browse files
committed
Adding back info about setting connection string via code
1 parent 1f0ee3a commit 235e62e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

articles/azure-monitor/app/opentelemetry-enable.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ OpenTelemetry offerings are available for .NET, Node.js, Python, and Java applic
3131
Follow the steps in this section to instrument your application with OpenTelemetry. Select a tab for langauge-specific instructions.
3232

3333
> [!NOTE]
34-
> .NET covers multiple scenarios, including classic ASP.NET, console apps, Windows Forms (WinForms), etc.
34+
> .NET covers multiple scenarios, including classic ASP.NET, console apps, Windows Forms (WinForms), and more.
3535
3636
### Prerequisites
3737

@@ -174,7 +174,9 @@ pip install azure-monitor-opentelemetry
174174
Add `UseAzureMonitor()` to your application startup, located in your `program.cs` class:
175175

176176
```csharp
177+
// Import the Azure.Monitor.OpenTelemetry.AspNetCore namespace.
177178
using Azure.Monitor.OpenTelemetry.AspNetCore;
179+
178180
var builder = WebApplication.CreateBuilder(args);
179181

180182
// Add OpenTelemetry and configure it to use Azure Monitor.
@@ -283,6 +285,9 @@ To copy the connection string:
283285

284286
To paste your connection string, select from the following options:
285287

288+
> [!NOTE]
289+
> We recommend setting the connection string through code only in local development and test environments. For production, use an environment variable or configuration file (Java only).
290+
286291
* Set via environment variable
287292

288293
Replace `<Your connection string>` in the following command with *your* unique connection string.
@@ -303,14 +308,15 @@ To paste your connection string, select from the following options:
303308
304309
Replace `<Your connection string>` in the preceding JSON with *your* unique connection string.
305310

306-
<!-- Violates MSFT security guidelines
307-
C. Set via Code - ASP.NET Core, Node.js, and Python Only (Not recommended)
311+
* Set via code - ***ASP.NET Core, Node.js, and Python only***
308312
309-
See [connection string configuration](opentelemetry-configuration.md#connection-string) for an example of setting connection string via code.
310-
-->
313+
See [connection string configuration](opentelemetry-configuration.md#connection-string) for an example of setting connection string via code.
311314

312315
> [!NOTE]
313-
> If you set the connection string in multiple places, the environment variable will be prioritized over the configuration file.
316+
> If you set the connection string in multiple places, the environment variable will be prioritized in the following order:
317+
> 1. Code
318+
> 2. Environment variable
319+
> 3. Configuration file
314320

315321
### Confirm data is flowing
316322

0 commit comments

Comments
 (0)