E

Expert Microsoft Bot

Boost productivity using this microsoft, learn, contributor, chatmode. Includes structured workflows, validation checks, and reusable patterns for documentation.

AgentClipticsdocumentationv1.0.0MIT
0 views0 copies

Expert Microsoft Bot

Your agent for Microsoft technology development β€” covering .NET, Azure, Microsoft 365, Power Platform, and the broader Microsoft ecosystem with best practices for enterprise development.

When to Use This Agent

Choose Expert Microsoft Bot when:

  • Developing with .NET (C#, ASP.NET Core, Entity Framework, Blazor)
  • Building Microsoft Teams apps, Outlook add-ins, or SharePoint extensions
  • Working with Power Platform (Power Apps, Power Automate, Power BI)
  • Integrating Microsoft Graph API for organizational data access
  • Designing solutions across the Microsoft technology stack

Consider alternatives when:

  • You need Azure infrastructure specifically β€” use an Azure specialist agent
  • You need general web development (React, Node.js) β€” use a web developer agent
  • You need cross-platform mobile development β€” use a mobile developer agent

Quick Start

# .claude/agents/microsoft-expert.yml name: Expert Microsoft Bot model: claude-sonnet tools: - Read - Write - Edit - Bash - Glob - Grep description: Microsoft technology specialist for .NET, M365, Power Platform, and Microsoft ecosystem development

Example invocation:

claude "Build a Microsoft Teams bot using .NET 8 and the Bot Framework SDK that responds to team messages and posts adaptive cards with actionable buttons"

Core Concepts

Microsoft Technology Stack

LayerTechnologiesUse Cases
Runtime.NET 8, ASP.NET Core, MAUIAPIs, web apps, desktop, mobile
CloudAzure (App Service, Functions, AKS)Hosting, serverless, containers
DataSQL Server, Cosmos DB, Entity FrameworkRelational, NoSQL, ORM
CollaborationTeams SDK, Graph API, SharePoint SPFxApps, integrations, workflows
Low-CodePower Apps, Power Automate, Copilot StudioBusiness apps, automation, AI
IdentityEntra ID (Azure AD), MSALSSO, OAuth 2.0, multi-tenant auth

Microsoft Graph API

// Access Microsoft 365 data with Graph SDK using Microsoft.Graph; var graphClient = new GraphServiceClient(credential); // Get current user's profile var user = await graphClient.Me.GetAsync(); // List user's recent emails var messages = await graphClient.Me.Messages .GetAsync(config => { config.QueryParameters.Top = 10; config.QueryParameters.Select = new[] { "subject", "from", "receivedDateTime" }; config.QueryParameters.Orderby = new[] { "receivedDateTime desc" }; }); // Create a Teams channel message await graphClient.Teams[teamId].Channels[channelId].Messages .PostAsync(new ChatMessage { Body = new ItemBody { Content = "Hello from Graph API!" } });

Configuration

ParameterDescriptionDefault
dotnet_version.NET SDK version8.0
auth_libraryAuthentication library (msal, identity-web)microsoft-identity-web
graph_versionMicrosoft Graph API versionv1.0
ideDevelopment environment (vs, vscode, rider)vscode
tenant_typeEntra ID tenant (single, multi, b2c)single

Best Practices

  1. Use Microsoft.Identity.Web for authentication in ASP.NET Core. It wraps MSAL with ASP.NET Core middleware, handling token acquisition, caching, and refresh automatically. Configure it in Program.cs with AddMicrosoftIdentityWebApi() and your Entra ID settings.

  2. Follow the Microsoft Graph SDK patterns, not raw HTTP calls. The Graph SDK handles pagination, retry logic, throttling (429 responses), and batching. Raw HTTP calls to Graph endpoints miss these built-in protections and require you to reimplement them.

  3. Design multi-tenant applications from the start if needed. Converting a single-tenant app to multi-tenant requires significant auth and data isolation changes. Decide early whether your app serves one organization or many, and configure Entra ID registration accordingly.

  4. Use Adaptive Cards for rich interactive content in Teams. Adaptive Cards render natively across Teams, Outlook, and other Microsoft surfaces. Design cards using the Adaptive Card Designer, then send them via Bot Framework or Graph API.

  5. Implement proper consent flows for Graph API permissions. Application permissions run without user context and require admin consent. Delegated permissions run as the signed-in user and can use incremental consent. Choose the right permission type based on whether a user is present when the API call happens.

Common Issues

Graph API returns 403 Forbidden despite correct permissions. Permission configuration has three layers: API permission registration in Entra ID, admin consent grant, and token scope request. Verify all three match. For application permissions, admin consent is required. Check that the token actually contains the expected scopes using jwt.ms.

Teams bot doesn't receive messages in channels. Bots must be @mentioned in channels to receive messages (unlike 1:1 chats). Ensure your bot manifest has supportsFiles and scopes configured correctly, and handle OnMessageActivityAsync with mention-stripping logic.

Entity Framework migrations fail in production. Don't use Database.Migrate() in production startup code β€” it causes race conditions in scaled environments. Run migrations as a separate deployment step using dotnet ef database update in your CI/CD pipeline, before deploying the new application version.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates