Microsoft Entra Agent ID
General

Secure an n8n agent with Microsoft Entra Agent ID

In brief

The guide now specifies that postprovision setup and consent require a Global Administrator, and adds verification for the first app-only Microsoft Graph workflow.

What Entra admins need to know

Administrators following the deployment must use a Global Administrator account and can validate Agent ID access before configuring additional workflows.

This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.


title: Secure an n8n agent with Microsoft Entra Agent ID titleSuffix: Microsoft Entra Agent ID description: Deploy n8n on Azure Container Apps and secure AIApps. Then use an agent workflows with Microsoft Entra Agent ID andidentity to call Microsoft Graph or its MCP Server for Enterprise.server. ms.topic: how-to ms.date: 06/15/11/05/2026 ms.reviewer: astaykov ms.custom: msecd-doc-authoring-1013 ai-usage: ai-assisted

Secure an n8n agent with Microsoft Entra Agent ID

This guidearticle shows you how to deploy n8n on Azure Container Apps withand configure sample workflows that use Microsoft Entra Agent ID integration.ID. The deployment uses the Azure Developer CLI (azd) to provisionprovisions the infrastructure, createcreates the Microsoft Entra identity objects, and configure n8n workflows automatically.configures n8n.

UnlikeThis integration doesn't use the Authentication with Microsoft Entra ID Auth SDK (sidecar) pattern used for custom agents, the n8n integration uses theMicrosoft Entra ID Auth SDK sidecar. The n8n-nodes-entraagentid community node runs inside n8n. It reads the blueprint credential from the n8n credential store, obtains and caches access tokens, and makes them available to manage token acquisition directly within n8n workflows.downstream workflow nodes. The deployed workflows demonstrate bothsample includes autonomous (app-only) and on-behalf-of (OBO) token flows, with access toflows for Microsoft Graph and the Microsoft Graph MCP Server for Enterprise, https://mcp.svc.cloud.microsoft/enterprise.Enterprise.

Before you begin, make sure you have:

  • An Azure subscription with quota for Azure OpenAI (GPT-4o or a similar model), Azure Database for PostgreSQL flexible server, and Azure Container Apps.
  • Global Administrator role in your Microsoft Entra tenant for the object creation and admin consent steps. Use Privileged Identity Management (PIM) to activate this role just-in-time.only when needed.

Azure Cloud Shell (recommended) comes with everything preinstalled: Azure CLI, Azure Developer CLI (azd), PowerShell 7, and Git.

  • n8n admin email: Email for the n8n owner account.
  • n8n admin password: Password for the n8n owner account (minimum 8 characters, mixed case, number).
  1. During the postprovision phase, the automation performs a second sign-in. A device code is displayed. Open the URL and enter the code. This step requiresSign in with the Global Administrator or Application Administrator role.account required for the setup and consent operations. The azd up postprovision hook then:

      1. Creates Microsoft Entra Agent ID objects (Blueprint, Agent Identity, Agent User).the agent identity blueprint, agent identity, and agent user.
      2. Enables the Microsoft Graph MCP Server for Enterprise.
      3. Waits for n8n to become ready.
      4. Creates the owner account.
      5. Installs the @astaykov/n8n-nodes-entraagentid community node.
      6. Generates an API key for n8n automation.
      7. Creates all five credentials with real values.
      8. Imports and activates the three demo workflows.

When the deployment completes, the script prints your n8n URL and a summary of what was configured. The tenant ID is autodetected from your Azure sign-in, so no manual configuration is needed.

Verify the first workflow

Open the printed n8n URL and sign in with the owner account you configured. Start with HTTP Request with autonomous agent token, the included app-only Microsoft Graph workflow. Run it and check the execution result for a successful Graph response before adding MCP or interactive sign-in to your test.

A reachable n8n page verifies hosting, not Agent ID access. If the workflow fails, use the failing node to distinguish token acquisition from the Graph request. For a Graph authorization failure, review the agent identity's application permissions and admin consent. Don't use this autonomous credential to test the delegated-only MCP server.

Explore the deployed resources

The deployment creates Azure resources, Microsoft Entra identity objects, and n8n configuration assets that work together to support the sample workflows.

The automation creates these objects once and reuses them on subsequent runs:

  • Agent identity blueprint: App registration that issueswhose credential the community node uses to request tokens on behalf of Agent Identities via Federated Identity Credentials.for the agent identity.
  • Agent identity service principal: The AI agent's service principal. AcquiresService principal represented by app-only tokens for autonomous Microsoft Graph and MCP tokens autonomously.calls.
  • Agent user account: A cloud-Cloud-only user identity that enablesrepresented by delegated (OBO) token flows.tokens in the OBO flow.
  • Single page app (SPA) app registration: Client app for the webhook demo, preconfigured with redirect URIs and Blueprint API permissions.

The postprovision hook automatically configures n8n:

Credentials created:configured:

  • EntraAgentID - Autonomous: App-Blueprint credential used by the community node to obtain an app-only Microsoft Graph API token (no user context).access token.
  • EntraAgentID - Agent User OBO: DelegatedCredential configuration used by the community node to obtain a delegated access token on behalf offor the Agent User.agent user.
  • Azure OpenAI: Connection to the deployed GPT model for AI agent workflows.
  • AgentID Auth Manager - Access Token:credentials: Token forwarding from the Auth Manager to downstream nodes.
  • Bearer from AuthManager: Bearer Access-token forwarding forconfiguration used by downstream HTTP Request and MCP calls.workflow nodes.

Workflows imported:

  • HTTP Request with autonomous agent token: Demonstrates an autonomous agent calling Microsoft Graph directly with an app-only token.
  • Webhook - interactive agent (on-behalf-of): Webhook entry point that receives a bearer token from the SPA, calls the Auth Manager, and responds via the Graph MCP Server on behalf of the signed-in user.

Understand the token flow

The n8n deployment supports two token flow patterns:

  • Autonomous (app-only): The community node reads the blueprint credential from the n8n workflow uses the Agent Identity Blueprint credentials with Federated Identity Credentials to acquirecredential store and obtains an app-only token forthat represents the Agent Identityagent identity service principal. The workflow thenHTTP Request node passes the token in the authorization header when it calls Microsoft Graph directly with this token.Graph. No user context is involved.

  • On-behalf-of (OBO) with MCP: AThe browser-based SPA sendsobtains the signed-in user's token and passes it as a bearer token to anthe n8n webhook. The webhook calls the Auth Manager workflow,workflow gives that token and the blueprint credential to the community node, which usesperforms the Blueprint credentials to acquire a delegated token on behalf of the Agent User.OBO exchange. The Auth Manager forwardspasses the resulting delegated token to a subworkflow that callsthe MCP subworkflow, which includes it when calling the Microsoft Graph MCP Server for Enterprise, which translates MCP tool calls into Microsoft Graph API requests using the delegated token.Enterprise.

In both patterns, n8n stores the Agent Identity Blueprint acts as a token factory.blueprint credential. The Agent Identity Blueprint issues tokens for Agent Identities without storing credentials on the agent itself. The Auth Manager community node handlesobtains and caches the access token acquisition andby using AES-256-GCM cachingencryption within each workflow run. Downstream nodes receive the token for the resource call; they don't receive the blueprint credential.

Deploy the test SPA (optional)

Rerun and update the deployment

The deployment is fully idempotent:reuses existing resources and reapplies sample configuration:

  • Bicep skips Azure resources that already exist.
  • The azd environment saves Microsoft Entra object IDs (Blueprint, Agent Identity, Agent User, Blueprint secret) after the first run and reuses them on subsequent runs.
  • n8n configuration (credentials, workflows) is applied fresh each run, which allows repairing a broken state.

Preserve any workflow customizations before rerunning, and review the postprovision hooks because they reapply credentials and workflows. A rerun isn't a substitute for diagnosing a failed token exchange or missing permission grant.

To rerun just the postprovision scripts without modifying infrastructure, run provisioning again. The Bicep templates detect no infrastructure changes and only execute the deployment hooks:


## Related content

- [Integrate third-party agents with Microsoft Entra Agent ID][Choose an integration path for an agent](configure-third-party-agents.choose-agent-integration-path.md)
- [Authentication with Microsoft Entra ID Auth SDK (sidecar)](authentication-with-auth-sdk-sidecar.md)
- [n8n-nodes-entraagentid community node](https://www.npmjs.com/package/@astaykov/n8n-nodes-entraagentid)
- [Azure Developer CLI overview](/azure/developer/azure-developer-cli/overview)
Daily Entra.News

Get daily email updates

Get a concise summary of the latest Microsoft Entra updates delivered straight to your inbox.

Loading the secure signup form…