Deploying Existing Agentic Services to Microsoft 365 Copilot via Gateway and OBO

· Source: Microsoft Foundry Blog articles · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure, Software Development & Engineering · Depth: Advanced, extended

Summary

The article describes a method for deploying existing agentic services to Microsoft 365 Copilot using a gateway and On-Behalf-Of (OBO) token exchanges. It outlines an architecture with two independently deployable services: a stateless M365 Gateway and a stateful Agentic Service. The gateway handles Bot Framework protocol, channel authentication, and the first OBO token exchange, translating Copilot conversations into the service's native API. The agentic service, which can use frameworks like LangChain or Semantic Kernel, validates the inbound service token, manages session memory, and performs a second OBO exchange for user-delegated access to downstream services like Microsoft Graph or Azure Databricks. This approach allows developers to retain control over their agentic logic and framework choices, avoiding a full rebuild within M365 Copilot Agents. The guide details Entra ID app registrations, token flow, component implementation, and a 12-step deployment sequence, emphasizing security best practices like JWT validation and ContextVar for assertion management. The article was updated on May 21, 2026.

Key takeaway

For AI Architects or MLOps Engineers deploying custom agentic services to Microsoft 365 Copilot, this gateway and chained OBO pattern offers a robust alternative to rebuilding. You can preserve existing agentic logic and frameworks while ensuring secure, user-delegated access to downstream services. Prioritize strict JWT validation at both gateway and service boundaries, and implement ContextVar for secure token assertion management to maintain trust and prevent data leakage. This approach provides greater control and flexibility.

Key insights

Deploy existing agentic services to M365 Copilot by using a stateless gateway and chained On-Behalf-Of token exchanges for user-delegated access.

Principles

Method

Deploy an M365 Gateway in front of an existing agentic service, handling Bot Framework protocol, channel auth, and OBO #1. The service validates tokens, runs agentic logic, and performs OBO #2 for downstream access.

In practice

Topics

Code references

Best for: AI Engineer, AI Architect, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Microsoft Foundry Blog articles.