Skip to content

This repository contains a .NET console application that demonstrates how to connect to and query Microsoft Dataverse using OAuth authentication and the Dataverse Web API.

Notifications You must be signed in to change notification settings

joshuaskipper/DataverseReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Dataverse Reader

This repository contains a .NET console application that demonstrates how to connect to and query Microsoft Dataverse using OAuth authentication and the Dataverse Web API.

Getting Started

Prerequisites

  • .NET 6+ SDK
  • Azure App Registration with Dataverse API permissions
  • Practical OData query implementation against the standard Contacts DV table

Configuration

  1. Set up Azure App Registration:

    • Register an application in Azure Portal
    • Add API permission: Dataverse APIuser_impersonation
    • Create a client secret
  2. Configure the application: Replace these placeholders in Program.cs:

    string tenantId = "YOUR_TENANT_ID";          // Azure AD Directory (tenant) ID
    string clientId = "YOUR_CLIENT_ID";          // Application (client) ID
    string clientSecret = "YOUR_CLIENT_SECRET";  // Client secret value
    string dataverseUrl = "YOUR_DATAVERSE_URL";  // e.g., https://yourorg.crm.dynamics.com/

Security Note

⚠️ Important: The sample code contains placeholder credentials for demonstration purposes. In production environments, always:

  • Store credentials securely (e.g., Azure Key Vault, environment variables)
  • Never commit secrets to version control
  • Follow principle of least privilege for API permissions

Key Features

OAuth 2.0 authentication with MSAL (Microsoft.Identity.Client).

  • Customizable API queries ($select, $top, $orderby).
  • Structured JSON response parsing.
  • Error handling for API failures.

About

This repository contains a .NET console application that demonstrates how to connect to and query Microsoft Dataverse using OAuth authentication and the Dataverse Web API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages