Load Dynamics CRM data to Microsoft Fabric

Build a Dynamics CRM to Microsoft Fabric pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Dynamics CRM API base URL, auth, endpoints, and incremental loading.

SourceDynamics CRMDynamics 365 (Dataverse) Web API is a RESTful service used for interacting with platform data and table definitions based on the OData protocolDestination
Microsoft Fabric
Microsoft's unified analytics platform. Load data into Fabric with dlt and query it alongside the rest of your OneLake estate.

Dynamics 365 (Dataverse) Web API is a RESTful service used for interacting with platform data and table definitions based on the OData protocol. Everything needed to build a working Dynamics CRM → Microsoft Fabric pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.


Build your Dynamics CRM to Microsoft Fabric pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from Dynamics CRM to Microsoft Fabric and run it on dltHub

That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Dynamics CRM API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →

Prefer to write it yourself? Every fact the agent uses is below.


Dynamics CRM API at a glance

Base URLhttps://yourorg.api.crm.dynamics.com/api/data/v9.2/
Example endpointGET accounts
Records found atvalue
Authenticationall requests require a Bearer token via OAuth 2.0 — sent in the Authorization header, prefixed Bearer
PaginationCursor-based
Incremental fielddelta_link
Record idaccountid
API referencehttps://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/authenticate-web-api

These values come from the Dynamics CRM API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the Dynamics CRM API?

Authentication is handled via OAuth 2.0. Requests must include an Authorization header with a Bearer token: 'Authorization: Bearer <access_token>'

1. Get your credentials

  1. Register an application in the Microsoft Entra ID (Azure) portal: Go to App registrations, click New registration, provide a name, and select account types. 2. Copy the Application (client) ID and Directory (tenant) ID from the app's Overview page. 3. Generate a client secret: Navigate to Certificates & secrets, click New client secret, add a description, and copy the secret Value immediately (it cannot be retrieved later). 4. Add API permissions: Go to API permissions, click Add a permission, select Dynamics CRM (or Dataverse), and add the user_impersonation delegated/application permission. 5. Grant admin consent for the configured permissions. 6. Link the app to Dynamics 365: In the Power Platform Admin Center, navigate to the specific environment, go to S2S Apps or Users, and add the registered app as an Application User with an appropriate security role (e.g., System Administrator or custom restricted role).

2. Add them to .dlt/secrets.toml

[sources.dynamics_crm_source] dynamics_crm.client_id = "your_application_client_id_here" dynamics_crm.client_secret = "your_client_secret_value_here" dynamics_crm.tenant_id = "your_directory_tenant_id_here" dynamics_crm.resource_url = "https://yourorg.crm.dynamics.com"

dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.


What Dynamics CRM data can I load into Microsoft Fabric?

These are the Dynamics CRM endpoints dlt can load into Microsoft Fabric:

ResourceEndpointMethodData selectorDescription
Service Document/api/data/v9.2/GETvalueRetrieves the list of available entity sets for the environment.
Accounts/api/data/v9.2/accountsGETvalueRetrieves a collection of account entities.
Contacts/api/data/v9.2/contactsGETvalueRetrieves a collection of contact entities.
Leads/api/data/v9.2/leadsGETvalueRetrieves a collection of lead entities.
Opportunities/api/data/v9.2/opportunitiesGETvalueRetrieves a collection of opportunity entities.

How do I load only new Dynamics CRM records?

Dynamics CRM exposes delta_link on accounts, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.

{"name": "accounts", "endpoint": { "path": "accounts", "data_selector": "value", "incremental": {"cursor_path": "delta_link", "initial_value": "2024-01-01T00:00:00Z"}, }}

On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.


What does the generated Dynamics CRM pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading Discovery and Organization from the Dynamics CRM API into Microsoft Fabric:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def dynamics_crm_source(token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://yourorg.api.crm.dynamics.com/api/data/v9.2/", "auth": {"type": "bearer", "token": token}, }, "resources": [ {"name": "accounts", "endpoint": {"path": "accounts", "data_selector": "value"}}, {"name": "contacts", "endpoint": {"path": "contacts", "data_selector": "value"}} ], } yield from rest_api_resources(config) def load_dynamics_crm_to_fabric() -> None: pipeline = dlt.pipeline( pipeline_name="dynamics_crm_pipeline", destination="fabric", dataset_name="dynamics_crm_data", ) load_info = pipeline.run(dynamics_crm_source()) print(load_info) if __name__ == "__main__": load_dynamics_crm_to_fabric()

Run it with python dynamics_crm_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.


How do I query Dynamics CRM data in Microsoft Fabric?

dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("dynamics_crm_pipeline").dataset() df = data.accounts.df() print(df.head())

SQL:

SELECT * FROM dynamics_crm_data.accounts LIMIT 10;

See querying your data with dataset and exploring it in marimo notebooks.


How do I deploy the Dynamics CRM to Microsoft Fabric pipeline in production?

The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.

  • Deploy & schedule — run the pipeline as a managed job with automatic retries.
  • Monitor — observable job queues, alerting, and load metrics for every run.
  • Transform — promote raw Dynamics CRM loads into governed, documented models.
  • Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.

Book a demo →


What other destinations can I load Dynamics CRM data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample value
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.


Next steps

Was this page helpful?

Community Hub

Need more dlt context for Dynamics CRM to Microsoft Fabric?

Request dlt skills, commands, AGENT.md files, and AI-native context.