[agentserver] Use system-assigned managed identity for Entra Azure Monitor auth#48097
Open
singankit wants to merge 1 commit into
Open
[agentserver] Use system-assigned managed identity for Entra Azure Monitor auth#48097singankit wants to merge 1 commit into
singankit wants to merge 1 commit into
Conversation
When APPLICATIONINSIGHTS_CONNECTION_STRING is set and APPLICATIONINSIGHTS_AUTH_MODE is Entra, pass a ManagedIdentityCredential (no client id) as the Azure Monitor exporter credential to the microsoft-opentelemetry distro. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3c15f03b-e6c3-49d7-ae4b-c0bef594022e
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds system-assigned managed identity authentication for Azure Monitor telemetry.
Changes:
- Detects Entra authentication mode.
- Creates a lazy
ManagedIdentityCredential. - Adds focused tracing tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
_tracing.py |
Configures managed identity authentication. |
_constants.py |
Defines the auth-mode environment variable. |
test_tracing.py |
Tests Entra credential wiring. |
Comment on lines
+254
to
+256
| credential = _create_managed_identity_credential() | ||
| if credential is not None: | ||
| kwargs["azure_monitor_exporter_credential"] = credential |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
APPLICATIONINSIGHTS_CONNECTION_STRINGis set andAPPLICATIONINSIGHTS_AUTH_MODEisEntra, themicrosoft-opentelemetrydistro is now configured with aManagedIdentityCredential(instantiated without a client id, i.e. the system-assigned identity) as the Azure Monitor exporter credential.This follows the distro README guidance for Entra-based Azure Monitor auth via the
azure_monitor_exporter_credentialkeyword.Changes
core/_tracing.py(_setup_distro_export): readsAPPLICATIONINSIGHTS_AUTH_MODE; onentra(case-insensitive) addsazure_monitor_exporter_credential._create_managed_identity_credential(): lazily importsazure.identity.ManagedIdentityCredential(not a hard dependency) and returnsNonewith a warning if unavailable, so setup degrades gracefully.core/_constants.py: added theAPPLICATIONINSIGHTS_AUTH_MODEwell-known env var.tests/test_tracing.py: addedTestEntraAuthModecoverage.Testing
pytest tests/test_tracing.py -k "Distro or Entra"— 6 passed.