Microsoft 365 Query

Microsoft 365 Query

Certified

Query Dataverse entities via OData

Executes an OData GET request against a Dataverse entity set. Supports $filter, $select, and $top query parameters. When fetchType is FETCH or STORE, follows @odata.nextLink pagination to retrieve all pages. When fetchType is FETCH_ONE, returns only the first record from the first page. Requires the Dataverse application permission Dynamics CRM user on the service principal.

yaml
type: io.kestra.plugin.microsoft365.dynamics365.dataverse.Query

Query active accounts from Dataverse

yaml
id: dataverse_query_accounts
namespace: company.team

tasks:
  - id: query
    type: io.kestra.plugin.microsoft365.dynamics365.dataverse.Query
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    orgUrl: "https://myorg.api.crm.dynamics.com"
    entitySetName: "accounts"
    filter: "statecode eq 0"
    select: "accountid,name,emailaddress1"
    top: 50
    fetchType: FETCH

Store all contacts to internal storage

yaml
id: dataverse_store_contacts
namespace: company.team

tasks:
  - id: store
    type: io.kestra.plugin.microsoft365.dynamics365.dataverse.Query
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    orgUrl: "https://myorg.api.crm.dynamics.com"
    entitySetName: "contacts"
    select: "contactid,fullname,emailaddress1"
    fetchType: STORE
Properties

Client ID

Client ID of the Azure service principal. If you don't have a service principal, refer to create a service principal with Azure CLI.

Entity set name

OData entity set name, e.g. accounts, contacts, leads.

Dataverse Organization URL

Base URL of the Dataverse organization, e.g. https://myorg.api.crm.dynamics.com. All OData API calls are made relative to {orgUrl}/api/data/v9.2/.

Tenant ID

Azure AD (Entra ID) tenant GUID used for authentication.

Client Secret

Service principal client secret. Use this for Client Secret authentication. Provide clientId, tenantId, and clientSecret. Either clientSecret OR pemCertificate must be provided, not both.

DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

Fetch type

FETCH_ONE — returns only the first record from the first page. FETCH — returns all records (following pagination) as a list in the task output. STORE — writes all records (following pagination) to Kestra internal storage as an Ion file.

OData $filter expression

Optional OData filter, e.g. statecode eq 0.

PEM Certificate

Alternative authentication method using certificate-based authentication. Use this for Client Certificate authentication. Provide clientId, tenantId, and pemCertificate. Either clientSecret OR pemCertificate must be provided, not both.

Reference (ref) of the pluginDefaults to apply to this task.

OData $select fields

Comma-separated list of fields to return, e.g. accountid,name.

Default100

Maximum records per page ($top)

Maximum number of records to return per OData page. When fetchType is STORE or FETCH, all pages are followed regardless of this value. When fetchType is FETCH_ONE, this is ignored and only the first record is returned. Defaults to 100.

SubTypeobject

Records

List of entity records returned; populated when fetchType is FETCH or FETCH_ONE.

Total number of records

Count of records returned (or stored) by the query.

Formaturi

URI of stored records file

URI of the Ion file containing all records; populated when fetchType is STORE.

Unitrecords

Total number of records returned by the query