- Introduction
- With Great Power Comes Great Responsibility
- ALM for Copilot Studio MCP Agents with D365 Finance
- 1. Package everything inside a Power Platform Solution
- 2. Environment topology
- 3. Pipeline option A — Power Platform Pipelines (low-code ALM)
- 4. Pipeline option B — Azure DevOps with the Power Platform Build Tools
- 5. Coordinating with D365 FINANCE ALM
- 6. Service accounts and secrets per environment
- 7. Governance checklist before promoting to Production
- Closing Thought
Introduction
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.
What it unlocks in D365 Finance
- 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
Prerequisites
- 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
Setup in Copilot Studio (5 steps)
- Create or open an agent
- Tools tab → Add a tool
- Filter: Model Context Protocol
- Select: Dynamics 365 ERP MCP Server
- Connect → Add to Agent
Your agent can now perform almost every function a user can carry out through the D365 Finance UI.
With Great Power Comes Great Responsibility
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.
Precautions every implementation team must take
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.
ALM for Copilot Studio MCP Agents with D365 Finance
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.
1. Package everything inside a Power Platform Solution
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. |
2. Environment topology
A minimum viable topology for D365 Finance + MCP agents:
| Environment | Purpose | D365 link |
| DEV (Power Platform) | Agent authoring, unmanaged solution | DEV D365 sandbox |
| TEST / UAT | Functional + security validation | UAT D365 sandbox |
| PROD | Live agent | Production 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.
3. Pipeline option A — Power Platform Pipelines (low-code ALM)
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.
4. Pipeline option B — Azure DevOps with the Power Platform Build Tools
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)
- Checkout the solution source from Git (use Solution Packager to keep solutions unpacked as XML/JSON in the repo — diff-friendly and review-friendly)
- Pack the solution (SolutionPacker task)
- Run Solution Checker (PowerPlatformChecker) and fail on critical findings
- Publish the managed solution as a build artifact
Release pipeline (CD)
- Import the managed solution into UAT (PowerPlatformImportSolution)
- Set environment variables per stage (D365 endpoint, tenant, etc.)
- Update connection references to the target service-account connection
- 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)
- Manual approval gate
- 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.
5. Coordinating with D365 FINANCE ALM
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.
6. Service accounts and secrets per environment
| Environment | Service account | Secrets store |
| DEV | svc-mcp-agent-dev@… — broad sandbox rights for exploration | Dev key vault |
| UAT | svc-mcp-agent-uat@… — production-equivalent least-privilege roles | UAT key vault |
| PROD | svc-mcp-agent-prod@… — strict least-privilege, audited | Prod key vault |
Never reuse a service account across environments. Never store credentials in the solution.
7. Governance checklist before promoting to Production
☐ 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)
Closing Thought
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.

Leave a comment