Summary
This epic tracks the comprehensive integration of Microsoft ecosystem services into DuckDB via erpl-web. All Microsoft integrations share a common authentication layer using Microsoft Entra ID (Azure AD) OAuth2.
Shared Authentication Architecture
All Microsoft services use the same OAuth2 flow with Microsoft Entra ID:
Token Endpoint: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
Proposed Secret Types
Option A: Unified microsoft_entra secret type
CREATE SECRET ms_secret (
TYPE microsoft_entra,
PROVIDER client_credentials, -- or 'authorization_code'
CLIENT_ID ' xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' ,
CLIENT_SECRET ' your-client-secret' ,
TENANT_ID ' xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' ,
SCOPE ' https://graph.microsoft.com/.default' -- varies by service
);
Option B: Service-specific secrets with shared auth
-- Each service type maps to its scope internally
CREATE SECRET bc_secret (TYPE business_central, ...); -- scope: api.businesscentral.dynamics.com
CREATE SECRET crm_secret (TYPE dataverse, ...); -- scope: {env}.crm.dynamics.com
CREATE SECRET graph_secret (TYPE microsoft_graph, ...); -- scope: graph.microsoft.com
Scope Mapping
Service
OAuth2 Scope
Business Central
https://api.businesscentral.dynamics.com/.default
Dynamics 365 CRM / Dataverse
https://{org}.crm.dynamics.com/.default
Microsoft Graph (all services)
https://graph.microsoft.com/.default
Shared Components to Implement
MicrosoftEntraAuthProvider - Core OAuth2 client credentials and authorization code flows
TokenStorage - Secure token caching with automatic refresh
ScopeResolver - Map service types to OAuth2 scopes
Related Issues
Microsoft Dynamics 365
Microsoft Graph API
feat: Microsoft Graph API - Excel Workbooks (OneDrive/SharePoint) #7 - Excel Workbooks (tables, worksheets, ranges from OneDrive/SharePoint)
feat: Microsoft Graph API - SharePoint Lists #8 - SharePoint Lists (list items with OData queries)
feat: Microsoft Graph API - Planner (Tasks & Projects) #9 - Planner (tasks, plans, buckets for project analytics)
feat: Microsoft Graph API - Outlook (Calendar, Contacts, Mail) #10 - Outlook (calendar events, contacts, mail metadata)
feat: Microsoft Graph API - Entra ID (Users, Groups, Directory) #11 - Entra ID (users, groups, devices, sign-in logs)
feat: Microsoft Graph API - Teams (Channels, Messages, Members) #12 - Teams (teams, channels, members, messages)
Implementation Priority
Phase 1: Foundation
Implement shared MicrosoftEntraAuthProvider
Implement feat: Microsoft Dynamics 365 Business Central Integration #5 (Business Central) as first integration
Validate OAuth2 flows work correctly
Phase 2: Dynamics 365
Implement feat: Microsoft Dynamics 365 CRM / Dataverse Integration #6 (CRM/Dataverse) using shared auth
Refine shared components based on learnings
Phase 3: Microsoft Graph
Implement feat: Microsoft Graph API - Excel Workbooks (OneDrive/SharePoint) #7 (Excel) and feat: Microsoft Graph API - SharePoint Lists #8 (SharePoint Lists) - most common use cases
Implement feat: Microsoft Graph API - Entra ID (Users, Groups, Directory) #11 (Entra ID) - foundation for user/group context
Implement remaining: feat: Microsoft Graph API - Planner (Tasks & Projects) #9 (Planner), feat: Microsoft Graph API - Outlook (Calendar, Contacts, Mail) #10 (Outlook), feat: Microsoft Graph API - Teams (Channels, Messages, Members) #12 (Teams)
Testing Strategy
Use Microsoft 365 Developer tenant for testing
Mock responses for CI/CD (no live credentials in tests)
Integration tests with environment variables for credentials
Documentation
Each integration should document:
Required Azure app registration permissions
Example secret creation
Function catalog with examples
Rate limits and pagination behavior
References
Summary
This epic tracks the comprehensive integration of Microsoft ecosystem services into DuckDB via erpl-web. All Microsoft integrations share a common authentication layer using Microsoft Entra ID (Azure AD) OAuth2.
Shared Authentication Architecture
All Microsoft services use the same OAuth2 flow with Microsoft Entra ID:
Proposed Secret Types
Option A: Unified
microsoft_entrasecret typeCREATE SECRET ms_secret ( TYPE microsoft_entra, PROVIDER client_credentials, -- or 'authorization_code' CLIENT_ID 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', CLIENT_SECRET 'your-client-secret', TENANT_ID 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', SCOPE 'https://graph.microsoft.com/.default' -- varies by service );Option B: Service-specific secrets with shared auth
Scope Mapping
https://api.businesscentral.dynamics.com/.defaulthttps://{org}.crm.dynamics.com/.defaulthttps://graph.microsoft.com/.defaultShared Components to Implement
Related Issues
Microsoft Dynamics 365
Microsoft Graph API
Implementation Priority
Phase 1: Foundation
MicrosoftEntraAuthProviderPhase 2: Dynamics 365
Phase 3: Microsoft Graph
Testing Strategy
Documentation
Each integration should document:
References