m365-agents-dotnet

Host ASP.NET Core agents with MSAL authentication and Copilot Studio client setup.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/davidrrowley/CortexYouV3 --skill m365-agents-dotnet-davidrrowley
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m365-agents-dotnet
Source: https://github.com/davidrrowley/CortexYouV3/tree/main/.agents/skills/m365-agents-dotnet
Command: npx skills add https://github.com/davidrrowley/CortexYouV3 --skill m365-agents-dotnet-davidrrowley

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides a clear, production-oriented template and patterns to host, route, authenticate, and integrate Microsoft 365 agents using .NET so teams avoid reinventing boilerplate when building Teams, M365, or Copilot Studio integrations.

Core Features & Use Cases

  • ASP.NET Core hosting and endpoint wiring: patterns for registering agents, wiring /api/messages with IAgentHttpAdapter, and configuring HTTP clients.
  • AgentApplication routing and error handling: recommended AgentApplication subclass usage, conversation and activity handlers, and turn-level error recovery.
  • Authentication and Copilot integration: MSAL-based token acquisition, token validation guidance, and Copilot Studio client setup with IHttpClientFactory.
  • Use Case: Implement a Teams-facing agent that handles messages, validates tokens, routes intents via AgentApplication, and forwards queries to Copilot Studio for LLM-driven responses.

Quick Start

Host an ASP.NET Core agent with MSAL authentication and a Copilot Studio client using the described patterns to process incoming /api/messages.

Frequently Asked Questions about m365-agents-dotnet

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I host a Microsoft 365 agent in ASP.NET Core?

To host a Microsoft 365 agent in ASP.NET Core, you register the agent and wire the /api/messages endpoint using IAgentHttpAdapter. This provides the necessary HTTP hosting and routing infrastructure for multichannel deployment.

What's the best way to authenticate Microsoft Teams agents with MSAL in .NET?

Authenticating Microsoft Teams agents with MSAL in .NET involves applying MSAL-based token acquisition and token validation guidance. This secures your agent endpoints by validating incoming requests within the ASP.NET Core pipeline.

How do I connect a .NET agent to Copilot Studio for LLM responses?

To connect a .NET agent to Copilot Studio, you configure a Copilot Studio client using IHttpClientFactory. This setup allows your agent to forward queries and retrieve LLM-driven responses from the Copilot Studio integration.

How does AgentApplication routing handle errors for M365 agents?

AgentApplication routing handles errors by subclassing AgentApplication and implementing conversation and activity handlers. This pattern provides turn-level error recovery to manage exceptions during M365 agent message processing.

Can I use this approach to deploy multichannel agents across Teams and Copilot Studio?

Yes, you can use this ASP.NET Core approach to deploy multichannel agents across Teams and Copilot Studio. It supplies the endpoint handling, agent routing, and Copilot client connectivity needed for unified M365 integration.