Skip to main content
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. Select Manage in the upper-right navigation, and then select Project details.
  2. Select the existing Application Insights connection, and then select Edit authentication.
Screenshot of an Application Insights connection with the Edit authentication option highlighted.
  1. 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).
  1. Open your Foundry project.
  2. In the left navigation, select Agents.
  3. At the top, select Traces.
  4. 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. Select Manage in the upper-right navigation, and then select Project details.
Screenshot of the Manage section with the Project details option highlighted.
  1. Select the Connected resources tab, and then select Add connection.
Screenshot of Project details with the Connected resources tab selected and the Add connection button highlighted.
  1. 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.
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