Step-by-Step Guide: Building Dynamics 365 Finance AI Agents

Leverage the Microsoft ecosystem by building custom AI agents that interact with Dynamics 365 Finance & Operations through OData and the Power Platform, from authentication to a live collections agent.
- D365 exposes data via OData; agents authenticate with Entra ID using client credentials.
- Key finance entities: GeneralJournalAccountEntry, VendInvoiceJournal, CustTable and CustTrans.
- An intelligent collections agent is the highest-ROI first build, with policy-based escalation.
- Microsoft Fabric (OneLake) enables cross-entity analytics and predictive cash flow at scale.
- Start read-only, then add write actions with approval; ChatFin ships turnkey D365 agents.
Microsoft Dynamics 365 Finance is a powerhouse, but realizing its full potential requires automation users often spend hours navigating menus for routine tasks. By building custom AI agents that interact with D365 through OData and the Power Platform, you can automate AP invoice processing, credit control and financial reporting.
This technical guide walks through connecting generative AI to your D365 Finance instance, building an intelligent collections agent, and scaling analytics with Microsoft Fabric.
What You'll Build

Phase 1: OData & Data Entities
Dynamics 365 exposes its data through OData (Open Data Protocol), a standard REST-based protocol your agent uses to read and write data. For a finance agent you'll primarily interact with GeneralJournalAccountEntry (GL transactions), VendInvoiceJournalHeader and Line (AP automation), and CustTable and CustTrans (AR and collections). Authenticate with Entra ID (Azure AD) using the client-credentials flow.
import msal
import requests
# Entra ID (Azure AD) Configuration
config = {
"authority": "https://login.microsoftonline.com/YOUR_TENANT_ID",
"client_id": "YOUR_CLIENT_ID",
"scope": ["https://YOUR_D365_URL/.default"],
"secret": "YOUR_CLIENT_SECRET"
}
app = msal.ConfidentialClientApplication(
config["client_id"], authority=config["authority"],
client_credential=config["secret"]
)
result = app.acquire_token_for_client(scopes=config["scope"])
access_token = result.get("access_token")
# Query D365 Data
headers = {'Authorization': 'Bearer ' + access_token}
endpoint = "https://YOUR_D365_URL/data/Vendors?$top=5&$select=VendorAccount,Name"
response = requests.get(endpoint, headers=headers)
print(response.json())Data entities decide the output
A Dynamics 365 agent reads whatever the data entities expose, including stale customer records and inconsistent dimensions.
The AgentCFO podcast put it in the oldest terms, garbage in, garbage out, while noting that people who know how to instruct AI get far more from it.
Profile the data entities your agent will use before building logic on them, and fix the worst quality gaps first.
Phase 2: Intelligent Collections Agent
One of the highest-ROI applications is an AI collections agent. It monitors aging reports (CustTrans), identifies overdue invoices and drafts personalized outreach, escalating intelligently based on policy.
Phase 3: Integration with Microsoft Fabric
For deep analytics, connect D365 Finance data to Microsoft Fabric (OneLake) so your agent can query massive datasets with SQL or DAX without impacting transactional performance.

Next Steps
Start by building a read-only Finance Assistant that answers questions like what is our current cash position or who are our top 10 overdue vendors, before moving to write actions. Once you trust the read path, layer in the collections drafting and dispute handling with human approval, then expand into AP matching and forecasting.
Accelerate Your Dynamics 365 AI Journey
Building D365 finance agents is very achievable with OData, Entra ID and the Power Platform and the highest-ROI wins (collections, AP matching, predictive cash flow) are within reach in weeks. The engineering effort is mostly integration, controls and the edge cases, not the AI itself.
ChatFin offers deep, turnkey integration with D365 Finance & Operations providing pre-built AI agents for AP, AR and forecasting, so you can skip the build and deploy in days.