Skip to content

Azure-Samples/azmcp-foundry-aca-mi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure MCP Server - ACA with Managed Identity

This document explains how to deploy the Azure MCP Server 2.0-beta as a remote MCP server accessible over HTTPS. This enables AI agents from Microsoft Foundry and Microsoft Copilot Studio to securely invoke MCP tool calls that perform Azure operations on your behalf.

This reference Azure Developer CLI (azd) template shows how to host the server on Azure Container Apps with storage tools enabled, using managed identity authentication for secure access to Azure Storage.

Prerequisites

  • Azure subscription with Owner or User Access Administrator permissions
  • Azure Developer CLI (azd)
  • The list of Azure MCP Server tool areas (namespaces) you wish to enable (see azmcp-commands.md). This reference template uses the storage namespace

Quick Start

This reference template deploys the Azure MCP Server with read-only Azure Storage tools enabled, accessible over HTTPS transport. For details on customizing server startup flags and configuration, see Azure MCP Server documentation.

azd up

You'll be prompted for:

  • Storage Account Resource ID - The Azure resource ID of the storage account the MCP server will access
  • Microsoft Foundry Project Resource ID - The Azure resource ID of the Microsoft Foundry project for agent integration

What Gets Deployed

  • Container App - Runs Azure MCP Server with storage namespace
  • Role Assignments - Container App managed identity granted roles for outbound authentication to the storage account specified by the input storage resource ID:
    • Reader (read-only access to storage account properties)
    • Storage Blob Data Reader (read-only access to blob data)
  • Entra App Registration - For incoming OAuth 2.0 authentication from clients (e.g., agents) with Mcp.Tools.ReadWrite.All role. This role is assigned to the managed identity of the Microsoft Foundry project specified by the input Microsoft Foundry resource ID
  • Application Insights - Telemetry and monitoring

Deployment Outputs

After deployment, retrieve azd outputs:

azd env get-values

Among the output there are useful values for the subsequent steps. Here is an example of these values.

CONTAINER_APP_URL="https://azure-mcp-storage-server.wonderfulazmcp-a9561afd.eastus2.azurecontainerapps.io"
ENTRA_APP_CLIENT_ID="c3248eaf-3bdd-4ca7-9483-4fcf213e4d4d"
ENTRA_APP_IDENTIFIER_URI="api://c3248eaf-3bdd-4ca7-9483-4fcf213e4d4d"
ENTRA_APP_OBJECT_ID="a89055df-ccfc-4aef-a7c6-9561bc4c5386"
ENTRA_APP_ROLE_ID="3e60879b-a1bd-5faf-bb8c-cb55e3bfeeb8"
ENTRA_APP_SERVICE_PRINCIPAL_ID="31b42369-583b-40b7-a535-ad343f75e463"

Using Azure MCP Server from Microsoft Foundry Agent

Once deployed, connect your Microsoft Foundry agent to the Azure MCP Server running on Azure Container Apps. The agent will authenticate using its managed identity and gain access to the configured Azure Storage tools.

  1. Get your Container App URL from azd output: CONTAINER_APP_URL
  2. Get Entra App Client ID from azd output: ENTRA_APP_CLIENT_ID
  3. Navigate to your Foundry project: https://ai.azure.com/nextgen
  4. Go to BuildCreate agent
  5. Select the + Add in the tools section
  6. Select the Custom tab
  7. Choose Model Context Protocol as the tool and click Create Find MCP
  8. Configure the MCP connection Create MCP Connection
    • Enter the CONTAINER_APP_URL value as the Remote MCP Server endpoint.
    • Select Microsoft EntraProject Managed Identity as the authentication method
    • Enter your ENTRA_APP_CLIENT_ID as the audience.
    • Click Connect to associate this connection to the agent

Your agent is now ready to assist you! It can answer your questions and leverage tools from the Azure MCP Server to perform Azure operations on your behalf.

Clean Up

azd down

Template Structure

The azd template consists of the following Bicep modules:

  • main.bicep - Orchestrates the deployment of all resources
  • aca-infrastructure.bicep - Deploys Container App hosting the Azure MCP Server
  • aca-role-assignment-resource-storage.bicep - Assigns Azure storage RBAC roles to the Container App managed identity on the storage account specified by the input storage resource ID
  • entra-app.bicep - Creates Entra App registration with custom app role for OAuth 2.0 authentication
  • foundry-role-assignment-entraapp.bicep - Assigns Entra App role to the managed identity of the Microsoft Foundry project specified by the input Microsoft Foundry resource ID for the Azure MCP Server access
  • application-insights.bicep - Deploys Application Insights for telemetry and monitoring (conditional deployment)

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages