Deploying an Agentic Service to Microsoft 365 Copilot with Delegated OBO Access
Summary
This guide details a method for deploying existing agentic services to Microsoft 365 Copilot without requiring a full rewrite into Copilot-native agents. The architecture involves placing a stateless M365 Gateway in front of an existing agentic service, allowing the service to retain its original orchestration logic, framework choices, and session management. The gateway handles the Bot Framework protocol, validates channel tokens, performs the first On-Behalf-Of (OBO) token exchange, and translates Copilot conversations into the service's native API. This approach enables user-delegated access to downstream services like databases and APIs via chained OBO flows, with the agentic service validating inbound service tokens and managing its own OBO chain. The deployment requires two Entra ID app registrations (one for the service, one for the gateway/Bot) and specific configuration for admin consent and Azure Bot OAuth connections.
Key takeaway
For AI Architects or MLOps Engineers integrating custom agentic services with Microsoft 365 Copilot, this pattern offers a robust alternative to full rewrites. You should implement a dedicated M365 Gateway to handle protocol translation and initial OBO, allowing your existing agentic service to maintain its framework and logic. This preserves control over orchestration and enables secure, user-delegated access to downstream APIs via chained OBO, significantly reducing refactoring effort and accelerating deployment.
Key insights
Deploy existing agentic services to Microsoft 365 Copilot using a gateway for protocol adaptation and chained OBO authentication.
Principles
- Separate trust boundaries for gateway and agentic service.
- User tokens never leave the OBO chain.
- JWT validation is non-negotiable at each boundary.
Method
Deploy a stateless M365 Gateway to adapt Bot Framework protocol and perform OBO #1, then forward to a stateful agentic service that validates tokens and performs OBO #2 for downstream access.
In practice
- Use ContextVar for async-safe OBO assertion passing.
- Implement session management with owner isolation and concurrency locks.
- Build a thin, reusable gateway for multiple agentic services.
Topics
- Microsoft 365 Copilot Integration
- Agentic Service Deployment
- On-Behalf-Of (OBO) Access
- M365 Gateway Architecture
- Entra ID App Registration
Code references
Best for: AI Engineer, AI Architect, MLOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Microsoft Foundry Blog articles.