Microsoft Dynamics 365 (CRM)

@idaria/integration-dynamics-crmdynamics

Microsoft Dynamics 365 / Dataverse connector for idaria. OAuth2 client-credentials Web API client (read-mostly). Publishes the 'dynamics.client' + 'dynamics.cache' services and contributes the read-only dynamics_query tool — accounts, contacts, leads, opportunities and any custom table. Writes (dynamics_write) are opt-in.

integration · crm

Setup guide

Connect Microsoft Dynamics 365 (Dataverse)

This integration talks to the Dataverse Web API using an Azure AD app registration (server-to-server, OAuth2 client-credentials). About 10 minutes in the Azure + Power Platform admin portals. You collect four values — Tenant ID, Client ID, Client Secret, Environment URL — and paste them into the fields below.

1. Register an Azure AD application

  1. Azure Portal → Microsoft Entra ID → App registrations → New registration. Name it (e.g. "idaria Dynamics") → Register.
  2. On the Overview page copy the Application (client) ID, then click Endpoints and copy the OAuth 2.0 token endpoint (v2) — that is your Token URL (it embeds the tenant).
  3. Certificates & secrets → New client secret → set a long expiry (e.g. 24 months) → Add → copy the secret Value immediately (NOT the Secret ID — the value is shown only once).

You do not need to add any API permissions in Azure AD for this. Server-to-server access to Dataverse is granted by the application user + security role in step 2 below, not by Azure AD API permissions.

2. Create the application user in Dynamics

  1. Power Platform Admin Center → your environment → Settings → Users + permissions → Application users → + New app user.
  2. + Add an app → pick the app you registered (search by name / client ID) → choose a Business unit.
  3. Assign a security role with read access (and write, only if you plan to enable writes) on the tables you need. A least-privilege custom role is recommended over a broad built-in role.

3. Find your Environment URL

Power Platform Admin Center → Environments → your environment → the Environment URL on the detail page, e.g. https://contoso.crm4.dynamics.com. The crmN segment encodes your region (e.g. crm4 = Europe, crm = North America).

4. Fill in the fields below

FieldValue
Token URLOAuth 2.0 token endpoint (v2) — step 1.2
Base URLEnvironment URL — step 3 (…/api/data/v9.2 optional)
Client IDApplication (client) ID — step 1.2
Client SecretThe secret Value — step 1.3
ScopeEnvironment URL + /.default
Grant typeclient_credentials (default)

Install — the connection is verified in the background with a WhoAmI call (watch the plugin logs for connected or a WhoAmI failed warning).

Troubleshooting

  • 401 / authentication failed — wrong Client Secret (you copied the Secret ID, not the Value), expired secret, or wrong Token URL / Scope.
  • 403 / forbidden — the application user has no security role, or the role lacks privilege on that table. Revisit step 2.3.
  • Cannot reach the host — your region's crmN host may be missing from the network allow-list. Add it to permissions.network.outbound and rebuild.

Least privilege: scope the security role to exactly the tables and verbs you need. Leave Enable writes off unless the assistant should create/update records.

Setup fields

The operator fills these in when installing the plugin.

  • dynamics_token_urlstring, required
    Token URLFull OAuth2 token endpoint, e.g. https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token. From Azure AD → App registration → Overview → Endpoints → 'OAuth 2.0 token endpoint (v2)'. Maps to DYNAMICS_TOKEN_URL.
  • dynamics_base_urlstring, required
    Base URL (Web API)Dataverse Web API base — either the environment root (https://contoso.crm4.dynamics.com) or the full API base (.../api/data/v9.2). If /api/data/ is missing, /api/data/v9.2 is appended. Maps to DYNAMICS_BASE_URL.
  • dynamics_client_idstring, required
    Client ID (Application ID)Application (client) ID of the Azure AD app registration. Maps to DYNAMICS_CLIENT_ID.
  • dynamics_client_secretsecret, required
    Client SecretThe client secret VALUE (Certificates & secrets → New client secret). Stored encrypted in the vault and shown only once. Maps to DYNAMICS_CLIENT_SECRET.
  • dynamics_scopestring, required
    ScopeOAuth2 scope — the environment URL plus /.default, e.g. https://contoso.crm4.dynamics.com/.default. Maps to DYNAMICS_SCOPE.
  • dynamics_grant_typestring, optional
    Grant typeOAuth2 grant type. Default client_credentials. Maps to DYNAMICS_GRANT_TYPE.
Show all 9 setup fields
  • dynamics_max_bytesstring, optional
    Max response size (bytes)Caps a single Dataverse response to prevent memory blow-ups on large reads. Default 1048576 (1 MiB).
  • dynamics_cache_ttl_secondsstring, optional
    Read cache TTL (seconds)How long identical read queries are cached in-process. Writes always bypass + clear the cache. Default 60.
  • enable_writesboolean, optional
    Enable writesWhen ON, also registers the `dynamics_write` tool so the assistant can create/update records (delete is never exposed). Requires the application user to have write permission. Default OFF (read-only).

Permissions

This is everything the plugin is allowed to access once it is installed.

memory
readsnone
writesnone
graph
readsnone
writesnone
network
outboundlogin.microsoftonline.comlogin.microsoftonline.uslogin.partner.microsoftonline.cnglobaldisco.crm.dynamics.com*.crm.dynamics.com*.crm2.dynamics.com*.crm3.dynamics.com*.crm4.dynamics.com*.crm5.dynamics.com*.crm6.dynamics.com*.crm7.dynamics.com*.crm8.dynamics.com*.crm9.dynamics.com*.crm11.dynamics.com*.crm12.dynamics.com*.crm14.dynamics.com*.crm15.dynamics.com*.crm16.dynamics.com*.crm17.dynamics.com*.crm19.dynamics.com*.crm20.dynamics.com
filesystem
scratchno

Versions

VersionCoreSizePublishedsha256Download
v0.4.0latest>=1.78.0 <2.024.4 KB30 Nov 2026a979d199f3d2….zip