This is a proxy solution that connects Microsoft Foundry agents to Microsoft 365 Copilot and Teams using the Microsoft 365 Agents Toolkit.
- .NET 9 - Bot application runtime
- Microsoft 365 Agents SDK - Microsoft 365 Agents SDK
- Microsoft 365 Agents Toolkit - Formerly Teams Toolkit
- Microsoft Foundry Agent SDK - For agent integration
- Bicep - Infrastructure as Code
- Managed Identity - For production authentication (no secrets)
- Use the proxy pattern to route messages between M365 Copilot and Microsoft Foundry
- Bot Service acts as the messaging endpoint
- Managed Identity for authentication in production
- Client Secret + Single Tenant for local development
- SSO with federated credentials (no client secrets in SSO flow)
- Use C# 12 features and nullable reference types
- Follow async/await patterns consistently
- Use dependency injection for services
- Implement proper error handling and logging
- Use configuration-based settings (appsettings.json)
AzureAgent.cs- Main agent integration logicProgram.cs- Bot setup and middleware configuration- Bicep modules - Reusable infrastructure components
m365agents.yml- Orchestration for provisioning and deployment
- SSO authentication uses federated credentials
- Bot responds via
turnContext.SendActivityAsync() - Environment-specific configuration via
appsettings.{Environment}.json - Infrastructure deployments use conditional logic (first-time vs. update)
- Never commit secrets or
.envfiles - Use Managed Identity in production (no secrets)
- Use federated credentials for SSO (no client secrets)
- Keep
appsettings.Development.jsonin.gitignore
- Bicep modules: lowercase with hyphens (e.g.,
app-registration.bicep) - C# classes: PascalCase
- Environment variables: UPPER_SNAKE_CASE
- Resource names: Use consistent naming pattern with suffix
- Local: Press F5 in VS Code (automatic provisioning)
- Azure: Use
atk provisionandatk deploycommands - Two deployment modes: Local (dev tunnel) and Production (Azure App Service)
- Local debugging via F5 in VS Code
- Automatic sideloading in Teams/M365 Copilot
- Test SSO flow with federated credentials