Edit

Configure Microsoft Entra authentication for Foundry agent trace ingestion (preview)

Important

Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Use Microsoft Entra authentication for trace ingestion when your agents send telemetry to the Application Insights resource connected to your Foundry project. This approach replaces key-based ingestion with identity-based access control.

This article applies to Foundry agents that send traces to the Application Insights resource connected to your Foundry project.

Prerequisites

Connect Application Insights to your Foundry project

Foundry stores traces in Application Insights by using OpenTelemetry semantic conventions.

Update an existing connection

If your project already has a connection to Application Insights and you want to convert it to use Microsoft Entra authentication, follow these steps. If you don't have an existing connection, skip to Create a new connection.

  1. From your project name menu, select Project details. Screenshot of the project name menu showing the Project details option highlighted.
  2. Select the existing Application Insights connection, and then select Edit authentication. Screenshot of an Application Insights connection with the Edit authentication option highlighted.
  3. Select Project managed identity, and then select Save. Screenshot of the Edit authentication pane with Project managed identity selected and the Save button highlighted.

Create a new connection

  1. Sign in to Microsoft Foundry. Make sure the New Foundry toggle is on. These steps refer to Foundry (new).

  2. Open your Foundry project.

  3. In the left navigation, select Agents.

  4. At the top, select Traces.

  5. On the right, select Connect to create or connect an Application Insights resource.

    Screenshot of the Agents tab showing traces and the connect button.

  • To connect an existing resource, select the resource, and then select Connect.
  • To create a new resource, select Create new, and then complete the wizard.
  1. In the connection creation experience, set Auth type to Project Managed Identity.

Screenshot of Monitor settings showing Auth type options with Project Managed Identity available.

  1. Complete the wizard and select Create.

A confirmation message appears when the connection succeeds.

Use the project details connection path

If you don't see the message bar or Connect button, use this alternative way to enable Azure Monitor Application Insights.

  1. From your project name menu, select Project details. Screenshot of project name menu with project details highlighted.
  2. Select the Connected resources tab, and then select Add connection. Screenshot of project details with connected resources tab selected, highlighting add connection.
  3. In Choose a connection, select Application Insights. Screenshot of Choose a connection with Application Insights highlighted.
  1. Before you select Connect, in the connection creation experience, set Auth type to Project Managed Identity.

    Screenshot of Create a new connection showing Auth Type set to Project Managed Identity.

After you connect the resource, your project is ready for Entra-authenticated trace ingestion. Foundry uses project Managed Identity to ingest traces to connected Application Insights.

Note

When you create the connection from the Foundry portal with Auth type set to Project managed identity, the Foundry portal assigns the Monitoring Metrics Publisher role to the Foundry project managed identity.

Set up Entra authentication for hosted agent traces

For hosted agents, in addition to setting up the connection by using Project Managed Identity, you also need to grant the Agent Identity permission on the connected Application Insights resource.

This permission is required because hosted agent traces can come from two identities:

  • Foundry Agent Service emits server-side traces by using project managed identity.
  • Agent emits traces from code that runs in the hosted agent sandbox by using Agent Identity.

To assign the Monitoring Metrics Publisher role to the agent identity, use the Foundry portal or Azure CLI.

  1. In the Azure portal, open the Application Insights resource connected to your Foundry project.
  2. Select Access control (IAM).
  3. Select Add > Add role assignment.
  4. Select Monitoring Metrics Publisher, and then select Next.
  5. In Members, select the Agent Identity of hosted agent.
  6. Select Review + assign.

For detailed portal guidance, see Assign Azure roles using the Azure portal.

Troubleshoot common ingestion problems

Issue Likely cause Resolution
Error creating connection: Multiple connection with same category (AppInsights) created, we only allow to have 1 connection for category A trace connection to Application Insights is already configured for the project Update the existing connection instead of creating a new one.
azure.monitor.opentelemetry.exporter.export._base: Retryable server side error: Operation returned an invalid status 'Forbidden'. Your application might be configured with a token credential, but your Application Insights resource might be configured incorrectly. Application Insights isn't configured for Microsoft Entra ID authentication, or the ingestion identity is missing Monitoring Metrics Publisher on the connected Application Insights resource Disable local authentication on the connected Application Insights resource to enforce Microsoft Entra ID-only ingestion, then assign Monitoring Metrics Publisher to the identity that sends telemetry (for example, Project managed identity or Agent Identity).
Traces from agent code don't show up Agent code uses an identity that doesn't have permission to ingest telemetry, or sends data to a different Application Insights resource Assign Monitoring Metrics Publisher to the Agent Identity on the connected Application Insights resource, and verify your runtime points to that same resource.
Connection is created, but traces still don't show up Ingestion role assignment or connection settings aren't fully applied yet Verify the authentication type is set to Project managed identity, confirm role assignments for the required identity, and wait 2-5 minutes before checking the Traces page again.