File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
sdk/monitor/azure-monitor-opentelemetry Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
### Other Changes
12
12
13
+ - Added AAD auth samples to distro
14
+ ([ #37352 ] ( https://github.com/Azure/azure-sdk-for-python/pull/37352 ) )
15
+
13
16
## 1.6.2 (2024-09-05)
14
17
15
18
### Bugs Fixed
Original file line number Diff line number Diff line change
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+ """
4
+ An example to show an application using Opentelemetry tracing api and sdk with a Azure Managed Identity
5
+ Credential. Credentials are used for Azure Active Directory/EntraId Authentication.
6
+ """
7
+ # You will need to install azure-identity
8
+ from azure .identity import ManagedIdentityCredential
9
+ from azure .monitor .opentelemetry import configure_azure_monitor
10
+ from opentelemetry import trace
11
+
12
+
13
+ credential = ManagedIdentityCredential (client_id = "<client_id>" )
14
+ configure_azure_monitor (
15
+ credential = credential ,
16
+ )
17
+
18
+ tracer = trace .get_tracer (__name__ )
19
+
20
+ with tracer .start_as_current_span ("hello with aad managed identity" ):
21
+ print ("Hello, World!" )
22
+
23
+ input ()
Original file line number Diff line number Diff line change
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+ """
4
+ An example to show an application using Opentelemetry tracing api and sdk with a Azure Client Secret
5
+ Credential. Credentials are used for Azure Active Directory/EntraId Authentication.
6
+ """
7
+ # You will need to install azure-identity
8
+ from azure .identity import ClientSecretCredential
9
+ from azure .monitor .opentelemetry import configure_azure_monitor
10
+ from opentelemetry import trace
11
+
12
+ credential = ClientSecretCredential (
13
+ tenant_id = "<tenant_id" ,
14
+ client_id = "<client_id>" ,
15
+ client_secret = "<client_secret>" ,
16
+ )
17
+ configure_azure_monitor (
18
+ credential = credential ,
19
+ )
20
+
21
+ tracer = trace .get_tracer (__name__ )
22
+
23
+ with tracer .start_as_current_span ("hello with aad client secret" ):
24
+ print ("Hello, World!" )
25
+
26
+ input ()
You can’t perform that action at this time.
0 commit comments