/m365-platform-clients:m365-clientsfrom m365-platform-clients
TypeScript patterns for authenticating and calling Dataverse Web API and Microsoft Graph, including shared Azure identity auth, DefaultAzureCredential, managed identity, and combined provisioning workflows.
Ships in m365-platform-clients. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
TypeScript patterns for authenticating and calling the Dataverse Web API and Microsoft Graph, including shared auth, typed clients, and combined provisioning workflows.
/api/data/v9.2/) or Graph (graph.microsoft.com)DefaultAzureCredential, managed identity, or client secret auth@azure/identity or @microsoft/microsoft-graph-client patterns┌─────────────────────────────────────────────────────┐
│ Your Node/TS Service │
│ │
│ ┌─────────────────┐ ┌────────────────────────┐ │
│ │ DataverseClient │ │ GraphService │ │
│ │ /api/data/v9.2/ │ │ graph.microsoft.com/v1 │ │
│ └────────┬─────────┘ └───────────┬────────────┘ │
│ └──────────┬───────────────┘ │
│ │ │
│ ┌─────────▼──────────┐ │
│ │ TokenProvider │ │
│ │ DefaultAzureCred │ │
│ └─────────┬──────────┘ │
└──────────────────────┼───────────────────────────────┘
│ OAuth2
▼
┌──────────────────┐
│ Microsoft Entra │
│ (one app reg) │
└────────┬─────────┘
┌─────────┴──────────┐
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Dataverse Env │ │ Microsoft Graph │
│ (App User + │ │ (application │
│ security role) │ │ permissions) │
└─────────────────┘ └──────────────────┘
npm install @azure/identity @microsoft/microsoft-graph-client
# For Graph auth middleware:
npm install @microsoft/microsoft-graph-client/authProviders/azureTokenCredentials
One credential instance serves both Dataverse and Graph. DefaultAzureCredential tries (in order):
AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET)az login)import { DefaultAzureCredential, TokenCredential } from "@azure/identity";
export function getCredential(): TokenCredential {
return new DefaultAzureCredential();
}
export async function getToken(credential: TokenCredential, scope: string): Promise<string> {
const response = await credential.getToken(scope);
if (!response?.token) throw new Error(`Token acquisition failed for: ${scope}`);
return response.token;
}
Local dev: Set AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET env vars.
Azure production: Use Managed Identity — zero secrets in config.
See references/azure-auth.md for complete auth patterns.
const client = new DataverseClient(
{ environmentUrl: "https://contoso.crm.dynamics.com" },
getCredential()
);
// Test connection
const whoAmI = await client.whoAmI();
// CRUD
const id = await client.create("accounts", { name: "Contoso" });
const account = await client.get("accounts", `$filter=name eq 'Contoso'`);
await client.patch("accounts", id, { revenue: 1000000 });
await client.delete("accounts", id);
See references/dataverse-client.md for the full typed client class.
const graph = new GraphService(getCredential());
// Users
const user = await graph.getUser("[email protected]");
// Teams
const channel = await graph.createTeamsChannel(teamId, "Project Alpha");
// SharePoint
const folder = await graph.createSharePointFolder(siteId, driveId, "root", "Project Alpha");
// Groups
const members = await graph.listGroupMembers(groupId);
See references/graph-client.md for the full service class.
The powerful pattern: orchestrate Dataverse record creation with Graph resource provisioning.
// 1. Create record in Dataverse
const projectId = await dvClient.create("new_projects", {
new_name: "Project Alpha",
new_status: "provisioning"
});
// 2. Provision M365 resources in parallel via Graph
const [channel, folder] = await Promise.all([
graph.createTeamsChannel(teamId, "Project Alpha"),
graph.createSharePointFolder(siteId, driveId, "root", "Project Alpha")
]);
// 3. Write Graph resource IDs back to Dataverse
await dvClient.patch("new_projects", projectId, {
new_status: "active",
new_teams_channel_id: channel.id,
new_sharepoint_folder_url: folder.webUrl
});
See examples/combined-workflows.md for complete provisioning patterns.
Dynamics CRM → user_impersonation (delegated) or application permissionMicrosoft Graph → Application permissions as needed (User.Read.All, Files.ReadWrite.All, Channel.Create, etc.)See references/azure-auth.md for step-by-step setup.
| Environment | Credential | Config |
|---|---|---|
| Local dev | Environment variables | AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET |
| Azure Functions | System-assigned MI | No env vars needed |
| AKS | Workload Identity | OIDC federation, no secrets |
| Non-Azure K8s | Client secret | Mount from K8s Secret / Vault |
| CI/CD pipelines | Client secret | From GitHub/Azure DevOps secrets |
DefaultAzureCredential handles the transition automatically — no code changes between environments.
| Resource | Path | Content |
|---|---|---|
| Azure Auth | references/azure-auth.md | DefaultAzureCredential, managed identity, Entra setup |
| Dataverse Client | references/dataverse-client.md | Full typed client class, CRUD, OData queries |
| Graph Client | references/graph-client.md | Full service class, Teams/SharePoint/Users |
| Environment Strategies | references/environment-strategies.md | Local vs prod auth, secrets management |
| Graph Client Patterns | references/graph-client-patterns.md | Middleware, JSON Batch, PageIterator, environment credentials |
| Auth Examples | examples/auth-patterns.md | Token providers for every environment |
| Dataverse Operations | examples/dataverse-operations.md | Common Dataverse patterns |
| Graph Operations | examples/graph-operations.md | Common Graph patterns |
| Combined Workflows | examples/combined-workflows.md | Dataverse + Graph provisioning |
| Topic | File |
|---|---|
| DefaultAzureCredential, managed identity, Entra app registration setup | references/azure-auth.md |
| Dataverse Web API typed client — CRUD, OData queries, batch, pagination | references/dataverse-client.md |
| Graph SDK service class — Users, Groups, Teams, SharePoint, Mail, Calendar | references/graph-client.md |
| Local vs prod auth strategies, secrets management, environment variables | references/environment-strategies.md |
| Advanced Graph patterns — middleware chain, JSON Batch, PageIterator, credential factory | references/graph-client-patterns.md |
examples/auth-patterns.md (opens in a new tab)examples/combined-workflows.md (opens in a new tab)examples/dataverse-operations.md (opens in a new tab)examples/graph-operations.md (opens in a new tab)references/azure-auth.md (opens in a new tab)references/dataverse-client.md (opens in a new tab)references/environment-strategies.md (opens in a new tab)references/graph-client-patterns.md (opens in a new tab)references/graph-client.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub thelobbi/claude-m --plugin m365-platform-clientsOther plugins' skills for the same job