Skip to content

Commit 3af7d1e

Browse files
authored
Update azure-ad-authentication.md
1 parent ea72ae9 commit 3af7d1e

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

articles/azure-monitor/app/azure-ad-authentication.md

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -235,65 +235,6 @@ After setting it, restart your application. It now sends telemetry to Applicatio
235235

236236
Azure Monitor OpenTelemetry Distro and Azure monitor OpenTelemery exporters for Python support the credential classes provided by [Azure Identity](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credential-classes).
237237

238-
- We recommend `DefaultAzureCredential` for local development.
239-
- We recommend `ManagedIdentityCredential` for system-assigned and user-assigned managed identities.
240-
- For system-assigned, use the default constructor without parameters.
241-
- For user-assigned, provide the client ID to the constructor.
242-
- We recommend `ClientSecretCredential` for service principals.
243-
- Provide the tenant ID, client ID, and client secret to the constructor.
244-
245-
If using `azure-monitor-opentelemetry`
246-
```python
247-
import os
248-
# You will need to install azure-identity
249-
from azure.identity import ManagedIdentityCredential
250-
from azure.monitor.opentelemetry import configure_azure_monitor
251-
from opentelemetry import trace
252-
253-
credential = ManagedIdentityCredential(client_id="<client_id>")
254-
configure_azure_monitor(
255-
connection_string=os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"],
256-
credential=credential,
257-
)
258-
259-
tracer = trace.get_tracer(__name__)
260-
261-
with tracer.start_as_current_span("hello"):
262-
print("Hello, World!")
263-
264-
```
265-
266-
If using `azure-monitor-opentelemetry-exporter`
267-
```python
268-
import os
269-
# You will need to install azure-identity
270-
from azure.identity import ClientSecretCredential
271-
from opentelemetry import trace
272-
from opentelemetry.sdk.trace import TracerProvider
273-
from opentelemetry.sdk.trace.export import BatchSpanProcessor
274-
275-
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
276-
277-
credential = ClientSecretCredential(
278-
tenant_id="<tenant_id",
279-
client_id="<client_id>",
280-
client_secret="<client_secret>",
281-
)
282-
exporter = AzureMonitorTraceExporter.from_connection_string(
283-
os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"],
284-
credential=credential
285-
)
286-
287-
trace.set_tracer_provider(TracerProvider())
288-
tracer = trace.get_tracer(__name__)
289-
span_processor = BatchSpanProcessor(exporter)
290-
trace.get_tracer_provider().add_span_processor(span_processor)
291-
292-
with tracer.start_as_current_span("hello with aad managed identity"):
293-
print("Hello, World!")
294-
295-
```
296-
297238
To configure using OpenCensus (deprecated), see [Configure and enable Microsoft Entra ID-based authentication](/previous-versions/azure/azure-monitor/app/opencensus-python#configure-and-enable-microsoft-entra-id-based-authentication).
298239

299240
---

0 commit comments

Comments
 (0)