Angel with glowing wings interacting with magical data streams and graphs in a fantasy city tower

MCP Agents in D365 Finance: Serious Responsibility

  1. Introduction
    1. What it unlocks in D365 Finance
    2. Prerequisites
    3. Setup in Copilot Studio (5 steps)
  2. With Great Power Comes Great Responsibility
    1. Precautions every implementation team must take
  3. ALM for Copilot Studio MCP Agents with D365 Finance
    1. 1.  Package everything inside a Power Platform Solution
    2. 2.  Environment topology
    3. 3.  Pipeline option A — Power Platform Pipelines (low-code ALM)
    4. 4.  Pipeline option B — Azure DevOps with the Power Platform Build Tools
      1. Build pipeline (CI)
      2. Release pipeline (CD)
    5. 5.  Coordinating with D365 FINANCE ALM
    6. 6.  Service accounts and secrets per environment
    7. 7.  Governance checklist before promoting to Production
  4. Closing Thought

The Model Context Protocol (MCP) is an open standard that connects AI agents to enterprise data systems. Think of it as a universal interface between your AI and your ERP.

  • Real-time agent access to ERP data and business logic
  • Works with Finance, Supply Chain, and every other extension in your environments
  • Governed by existing D365 security roles — no separate permission setup required
  • Compatible with any agent platform that supports MCP
  • D365 FINANCE version 10.0.47 or higher
  • Enable “Dynamics 365 ERP MCP Server” in Feature Management
  • Add your agent platform to the Allowed MCP Clients list
  1. Create or open an agent
  2. Tools tab → Add a tool
  3. Filter: Model Context Protocol
  4. Select: Dynamics 365 ERP MCP Server
  5. ConnectAdd to Agent

Your agent can now perform almost every function a user can carry out through the D365 Finance UI.

By default, this agent is not read-only. It can CREATE, UPDATE, and DELETE data in your D365 environment — exactly like a signed-in user.

1.  Security roles first, always

The agent inherits the security role of the service account connected to the MCP server. A service account with poorly scoped privileges gives the agent unlimited access to your entire ERP. Create a dedicated service account with least-privilege rights. Grant the agent only the roles it truly needs.

2.  Never connect MCP directly to Production during build

Always develop and test in Sandbox/UAT first. Validate every possible action the agent can take before going live. A single misworded instruction can mutate real data.

3.  Define the agent’s scope in your system prompt

Tell the agent clearly what it is — and isn’t — allowed to do. For example:

“You can review vendor invoices and the status of journal entries. Under no circumstances may you post, delete, or modify a transaction without explicit user confirmation.”

These guardrails must be built in at design time, not bolted on afterward.

4.  Build confirmation steps for every write action

For any create, update, or delete operation, the agent must systematically summarize the action it is about to perform and request explicit user approval before execution. Silent write operations should never be allowed.

5.  Review agent permissions regularly

As your agent evolves and new tools are added to the MCP server, its capabilities expand. Schedule periodic access reviews — just as you would for human users.

The technology is ready — but a production-grade rollout demands a real Application Lifecycle Management (ALM) strategy. Building an agent in a single environment and pushing it manually to Production is a fast track to incidents. Here is how to industrialize the lifecycle.

Copilot Studio agents are first-class Power Platform components. Always create them inside an unmanaged solution in your DEV environment, never in the default solution.

A well-structured solution should contain:

  • The agent itself (topics, instructions, knowledge sources)
  • The MCP tool connection references (the D365 ERP MCP Server connector reference, not the connection itself)
  • Any custom connectors, Power Automate flows, or Dataverse tables the agent depends on
  • Environment variables for everything that changes between environments: D365 FINANCE endpoint URLs, tenant IDs, feature flags, service-account principal IDs
⚠  Connections are never transported Only connection references travel inside the solution. Each target environment must bind the reference to a connection authenticated with the environment-specific service account — typically the least-privilege account scoped to that environment’s D365 instance.

A minimum viable topology for D365 Finance + MCP agents:

EnvironmentPurposeD365 link
DEV (Power Platform)Agent authoring, unmanaged solutionDEV D365 sandbox
TEST / UATFunctional + security validationUAT D365 sandbox
PRODLive agentProduction D365

Each Power Platform environment binds to its own D365 environment via environment variables — so a managed solution promoted from DEV to UAT automatically points at the UAT D365 instance, not Production.

For teams that want ALM without leaving the Maker portal, Pipelines in Power Platform are the fastest path to value:

  • Configure a host environment (a dedicated Power Platform environment that stores pipeline definitions)
  • Define a pipeline with stages: DEV → UAT → PROD
  • Set deployment approvers per stage
  • Makers click “Deploy” from inside the solution; the platform exports as managed, runs solution checker, and imports into the next stage

Pros: zero YAML, native to the Maker experience, built-in approvals.

Cons: less granular control, limited custom validation, weaker integration with broader DevOps practices.

Recommended for: small teams, citizen-developer-led agents, or pre-production pilots.

For enterprise scenarios — especially when the agent ships alongside D365 FINANCE X++ code, Power Automate flows, and custom connectors — Azure DevOps is the right home for ALM.

A typical pipeline shape:

Build pipeline (CI)

  1. Checkout the solution source from Git (use Solution Packager to keep solutions unpacked as XML/JSON in the repo — diff-friendly and review-friendly)
  2. Pack the solution (SolutionPacker task)
  3. Run Solution Checker (PowerPlatformChecker) and fail on critical findings
  4. Publish the managed solution as a build artifact

Release pipeline (CD)

  1. Import the managed solution into UAT (PowerPlatformImportSolution)
  2. Set environment variables per stage (D365 endpoint, tenant, etc.)
  3. Update connection references to the target service-account connection
  4. Run automated agent tests — replay a curated set of prompts against the agent and assert on responses (e.g., refusal of write actions without confirmation)
  5. Manual approval gate
  6. Promote to Production

Recommended tasks (Microsoft Power Platform Build Tools extension):

  • PowerPlatformToolInstaller
  • PowerPlatformExportSolution
  • PowerPlatformPackSolution
  • PowerPlatformChecker
  • PowerPlatformImportSolution
  • PowerPlatformPublishCustomizations
  • PowerPlatformSetSolutionVersion

Pair it with a service principal (not a user account) registered in each target environment as an Application User with the System Customizer role — this is what allows unattended deployments.

The agent is only half the story. The MCP server lives inside D365 FINANCE, which has its own ALM via LCS (Lifecycle Services) or Azure DevOps + Package Deployment. Two coupling rules:

  • Feature Management parity: the Dynamics 365 ERP MCP Server feature must be enabled in every D365 environment the agent targets — bake this into your environment-provisioning runbook.
  • Allowed MCP Clients list: the Power Platform environment ID (or tenant) must be whitelisted in every D365 environment. Track this configuration in Git (as documentation) and validate it as a pre-deployment step.

When you ship a new agent capability that depends on a new D365 entity or a new security privilege, release D365 first, then promote the agent solution. Reverse order causes runtime failures the moment the agent calls a tool that doesn’t exist yet.

EnvironmentService accountSecrets store
DEVsvc-mcp-agent-dev@… — broad sandbox rights for explorationDev key vault
UATsvc-mcp-agent-uat@… — production-equivalent least-privilege rolesUAT key vault
PRODsvc-mcp-agent-prod@… — strict least-privilege, auditedProd key vault

Never reuse a service account across environments. Never store credentials in the solution.

☐  Solution exported as managed

☐  Solution Checker — zero critical findings

☐  Environment variables set for the target environment

☐  Connection references bound to the PROD service account

☐  Allowed MCP Clients list updated in PROD D365

☐  Agent system prompt reviewed (scope, refusals, confirmation steps)

☐  Write-action confirmation flows tested end-to-end

☐  Audit logging enabled (Dataverse + D365 FINANCE)

☐  Rollback plan documented (previous solution version archived)

The technology is ready. The real question is whether your governance and ALM framework are ready to host it. An MCP agent without a pipeline, environment strategy, and least-privilege service accounts isn’t a productivity gain — it’s an incident waiting to happen.

Build the agent like you’d build any other production system: versioned, tested, promoted, and reviewed.


Comments

Leave a comment