Skip to content

[azure-ai-evaluation] Add Entra authentication for App Insights writeback#48250

Open
RabsB wants to merge 4 commits into
mainfrom
rabsb-entra-evaluation-writeback
Open

[azure-ai-evaluation] Add Entra authentication for App Insights writeback#48250
RabsB wants to merge 4 commits into
mainfrom
rabsb-entra-evaluation-writeback

Conversation

@RabsB

@RabsB RabsB commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • Add optional credential_type and TokenCredential fields to AppInsightsConfig.
  • Support ProjectManagedIdentity authentication while retaining the Application Insights connection string for resource identification and ingestion routing.
  • Wrap the supplied credential so every exporter token acquisition and refresh delegates with exactly https://monitor.azure.com/.default.
  • Preserve ApiKey as a first-class authentication mode and retain backward-compatible API-key behavior when the discriminator is absent.
  • Fail explicitly for missing PMI credentials, unsupported authentication types, exporter failures, and flush timeouts without creating DefaultAzureCredential or falling back to another authentication mode.

Testing

  • Added focused coverage for exporter setup, exact scope and repeated refresh delegation, missing credentials, unsupported modes, environment preservation, failure propagation, API-key compatibility, and exporter shutdown.
  • Targeted result: 12 passed.

Deployment notes

The caller remains responsible for supplying the project identity credential. Monitoring Metrics Publisher RBAC on the connected Application Insights resource is external to this SDK change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2c234682-eb8a-47b6-add7-ba0edb243d8a
@azure-pipelines

Copy link
Copy Markdown
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.

@github-actions github-actions Bot added the Evaluation Issues related to the client library for Azure AI Evaluation label Jul 24, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2c234682-eb8a-47b6-add7-ba0edb243d8a
@RabsB RabsB self-assigned this Jul 24, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2c234682-eb8a-47b6-add7-ba0edb243d8a
Comment thread sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluate/_evaluate.py Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2c234682-eb8a-47b6-add7-ba0edb243d8a
@RabsB
RabsB marked this pull request as ready for review July 24, 2026 23:51
@RabsB
RabsB requested a review from a team as a code owner July 24, 2026 23:51
Copilot AI review requested due to automatic review settings July 24, 2026 23:51
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Entra authentication for Application Insights evaluation-result writeback while preserving API-key support.

Changes:

  • Extends AppInsightsConfig with credential options.
  • Adds scoped credential delegation and export-failure tracking.
  • Adds authentication, failure, timeout, and compatibility tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
_model_configurations.py Adds authentication fields to App Insights configuration.
_evaluate/_evaluate.py Implements scoped Entra authentication and failure handling.
test_evaluate.py Tests authentication modes and exporter behavior.

export_result_tracker: Optional["_ExportResultTrackingLogExporter"] = None
log_exporter: Any = azure_log_exporter
if use_entra_authentication:
export_result_tracker = _ExportResultTrackingLogExporter(azure_log_exporter, LogExportResult.FAILURE)
Comment on lines +1543 to +1544
if credential_type is None or credential_type == "ApiKey":
return exporter_options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Evaluation Issues related to the client library for Azure AI Evaluation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants