Introduction
Building AI agents that can actually do things in your business systems—create records, update opportunities, trigger workflows—typically requires weeks of custom integration work. The Dataverse MCP Server changes that.
In this tutorial, you’ll connect a Microsoft Foundry agent to your Dataverse environment in under 30 minutes, giving your AI agent secure, real-time access to your Dynamics 365 and Power Platform data.
High Level Architecture
Deployment Steps
Step 1: Create App Registration
App Registration in Microsoft Entra ID provides a trusted identity for the MCP client (Microsoft Foundry agent, Copilot Studio agent, or custom application). It enables OAuth authentication by supplying a Client ID, Client Secret/Certificate, and the required Dataverse API permissions. When an agent connects to the Dataverse MCP Server, Microsoft Entra ID issues an access token based on the app registration. The MCP Server validates this token and securely accesses Dataverse on behalf of the user or application.
Perform following steps:
- Launch Azure portal. Search for App registrations.
- Click New Registration. Provide a name and click “Register” as shown below.
- Click API Permissions, then click “Add a permission”. In Microsoft APIs tab, select the Dynamics CRM. For Microsoft Graph, make sure you have offline_access, openid, and profile selected.
- Click “Grant admin consent”.
- Click on “Certificates & Secrets”. Create a new client secret.
- Grab a secret and Client ID from the overview tab of the app registration as you would need those in configuring MCP server in Microsoft Foundry or any other client.
Step 2: Power Platform Configuration
Before your agent can connect, you need to enable MCP access in your Power Platform environment. Here’s how:
- Launch Power Platform admin center (https://admin.powerplatform.microsoft.com)
- Click on your environment.
- Click Settings
- Expand “Product”. Click Features
- Make sure, you have “Allow MCP clients to interact with Dataverse MCP server” is checked. Otherwise, request will be denied. Below diagram shows this configuration.
Step 3: Configure Microsoft Foundry agent
- Launch Microsoft Foundry. Microsoft Foundry provisioning is beyond the scope of this article.
- In your AI agent, click “Add”, the “Add tools”
- Visit Custom Tab, select Model Context Protocol (MCP), and click “Create”
- Fill up the connection with the following. Provide the client id and secret captured previously.
Remote MCP server endpoint for Dynamics is as follows
https://
.crm.dynamics.com/api/mcp
Capture the Tenant ID from the overview tab of app registration. Token URL when using Azure Entra ID with App registration is below
https://login.microsoftonline.com/
/oauth2/v2.0/token
and Auth URL is formatted as
https://login.microsoftonline.com/
/oauth2/v2.0/authorize
For Refresh URL, use the same Token URL for refreshing the access token when is expires.
For Scopes, provide the following.
https://
.crm.dynamics.com/.default
- Click “Connect”. This will provide Redirect URL. Capture this URL in the clipboard.
- Launch Azure portal, visit the app registration. Click Authentication tab.
- Click Add Redirect URI.
- Click “Web”. Paste the Redirect URI. Click Configure.
Step 4: Validate the connection
Now in the agent, ask a question such as “Give me the list of accounts.” This will initiate the sign-in flow to Dynamics 365.
Click Open Consent as shown below.
Pick an account
Complete the confirmation. Click on the check box and then click “Allow access”
Once completed successfully, you get the following screen. you can close this window, or it will auto close after few seconds.
After the successful authentication, it will invoke the MCP tool as shown below. You may need to approve the tool, if the MCP configuration requires it.
You need to approve all the tools in the chain.
Then you get the final result.
View of dynamics table shows the following.
Troubleshooting
401 Unauthorized errors: Verify that admin consent was granted for the API permissions and that the client secret hasn’t expired.
MCP connection fails: Confirm the ‘Allow MCP clients to interact with Dataverse MCP server’ setting is enabled in Power Platform admin center.
Token refresh issues: Ensure the Refresh URL matches your Token URL exactly.
Next Steps
Try it now: Deploy your first Dataverse MCP connection
Go deeper: – Microsoft Foundry documentation – MCP specification
Get help: Have questions or feedback? Join the discussion on Microsoft Q&A or leave a comment below.
