microsoft/agents/agents-sdk-dotnet
Claude Code and agent skill by microsoft/agents
- vendor
Checking that the SKILL.md file is still in the repository.
Use when any code imports Microsoft.Agents.Hosting.AspNetCore, Microsoft.Agents.Builder, or related Agents SDK packages, or when the user is building, configuring, or asking questions about a Microsoft 365 Agents SDK agent in C# / .NET. Trigger on questions about appsettings.json, connection configuration, AgentApplication patterns, OAuth sign-in flows, storage backends, cards, streaming, or local testing with the Agents Playground — even if no code exists yet and the user is planning or asking how to get started.
Install
npx vskill@latest install microsoft/agents/agents-sdk-dotnetSKILL.md
The same SKILL.md was published earlier as microsoft/agents/agents-sdk-dotnet.
Overview
The Microsoft 365 Agents SDK builds multichannel agents for Teams, Copilot Studio, and web chat.
| Package | Purpose | |
|---|---|---|
Microsoft.Agents.Hosting.AspNetCore | ASP.NET Core hosting, auth, endpoint mapping | |
Microsoft.Agents.Authentication.Msal | MSAL-based auth (client credentials, OBO) | |
Microsoft.Agents.Builder | Core: AgentApplication, ITurnContext, ITurnState | |
Microsoft.Agents.Core | Models, activity types, channel accounts | |
Microsoft.Agents.Storage | IStorage, MemoryStorage | |
Microsoft.Agents.Extensions.MSTeams | Teams-specific models and AgentExtension | |
Microsoft.Agents.Extensions.A2A | Agent-to-agent (A2A) protocol AgentExtension | |
Microsoft.Agents.Extensions.Slack | Slack AgentExtension | |
Microsoft.Agents.Builder.Dialogs | Dialog system (waterfall, prompts) |
Minimal project requires only: Microsoft.Agents.Hosting.AspNetCore + Microsoft.Agents.Authentication.Msal. Core builder, model, and memory-storage dependencies are transitive. Install optional AgentExtensions, dialogs, and persistent storage providers explicitly when needed.
Always use the latest non-beta (stable) version. Do not use --prerelease unless specifically needed.
Requires .NET 8+.
Azure Resources Required
For Teams and other Azure Bot Service channels:
Microsoft Entra App Registration
ClientId— Application (client) IDClientSecret— Certificates & secretsTenantId— Directory (tenant) ID
Azure Bot Resource
- Messaging endpoint:
https://<your-host>/api/messages - Microsoft App ID must match
ClientId
Anonymous local testing with Agents Playground does not require an Azure Bot. With the Quick Start hosting setup, authentication is disabled by default in the Development environment.
Configuration (appsettings.json)
See Configure authentication in your agent (.NET) for MSAL credential types and configuration settings. Connection settings acquire outbound tokens; the TokenValidation section configures validation of inbound tokens.
Single connection (most common)
appsettings.json — no secret here (safe to commit):
appsettings.Development.json — secret lives here (excluded via .gitignore):
How ConnectionsMap works
Each entry maps a ServiceUrl pattern to a named connection. The first matching entry wins.
ServiceUrl: "*"— matches any service URL (use as the default/fallback)- Other values are treated as regex patterns
Multiple connections (different identities per channel)
Auth type variants
UserManagedIdentity (no secret, Azure-hosted only):
FederatedCredentials (no secret, App Registration + MSI):
Available connection settings fields
AuthType, AuthorityEndpoint, ClientId, ClientSecret, TenantId, FederatedClientId, FederatedTokenFile, Scopes, CertSubjectName, CertThumbprint, CertStoreName
Local development and inbound authentication
With the Quick Start setup, AddAgentAuthorization skips its authentication callback in Development and enables it in other environments. MapDefaultAgentEndpoints automatically applies the matching authorization requirement. Set ASPNETCORE_ENVIRONMENT=Development for anonymous local testing; no token-validation configuration switch is needed.
To test authenticated requests locally, replace the authorization registration with:
Supply valid TokenValidation:Audiences, TokenValidation:TenantId, and connection settings when authentication is enabled. Keep production outside Development; do not force anonymous access in a deployed agent.
Quick Start
Use the current `samples/dotnet/quickstart` as the startup reference.
Prerequisite: Copy its `AspNetExtensions.cs` into your project. This sample helper provides AddAgentAspNetAuthentication for JWT token validation.
Program.cs:
The explicit MemoryStorage registration matches the quickstart, but is optional: the SDK falls back to MemoryStorage if IStorage is not registered. Use a persistent provider for production (see Storage).
MyAgent.cs — put the AgentApplication subclass in its own file (see AgentApplication Patterns below for routing, state, and auth examples).
Properties/launchSettings.json:
Run: dotnet run
.gitignore — ensure appsettings.Development.json is excluded (it contains secrets):
Teams app manifest (if targeting Teams): Use the teams-app-manifest skill from agents-sdk-common to generate or validate a manifest against the agent's implemented Teams capabilities. For a starting example, copy `quickstart/appManifest`, including the icons. Update manifest.json:
- Replace all
${{AAD_APP_CLIENT_ID}}with your bot's Client ID - Set
name.shortandname.fullto your bot's display name - Replace
<<BOT_DOMAIN>>with the agent's host name and update the app metadata and URLs
Program.cs Structure
Minimal setup
Use the Quick Start Program.cs above. The responsibilities are:
| Call | Purpose | |
|---|---|---|
AddAgentDefaults() | Register the default HTTP client factory and MVC/authorization services | |
AddAgent<MyAgent>() | Register the agent and its application options | |
AddAgentAuthorization(b => b.AddAgentAspNetAuthentication()) | Configure inbound JWT authentication outside Development by default | |
UseAgents() | Add authentication and authorization middleware in the correct order | |
MapDefaultAgentEndpoints() | Map GET / and agent message endpoints, applying the configured authorization requirement |
With proactive messaging endpoints
Add this before app.Run(). If authentication is forced on in Development, also set requireAuth: true for these separately mapped proactive endpoints.
With custom routes
Agent class decorators
Important: AddAgent vs AddAgentApplicationOptions
builder.AddAgent<T>()— registers the agent class. Always required.- Do not call
AddAgentApplicationOptions()separately unless you have a specific reason —AddAgenthandles it.
Important: Default vs manual endpoint mapping
- Prefer
MapDefaultAgentEndpoints()forAgentApplicationsubclasses with the hosting setup above. MapAgentRootEndpoint()andMapAgentApplicationEndpoints(requireAuth: ...)remain available for manual endpoint/authentication control.MapAgentEndpoints— forActivityHandler/TeamsActivityHandlercompat layer bots
Do not use the compat-layer mapper for an AgentApplication subclass.
Validating Your Configuration
1. Validate bot credentials (ClientId / ClientSecret / TenantId)
Common errors:
AADSTS700016—ClientIdnot found in tenant (wrong ID or wrong tenant)AADSTS7000215— invalidClientSecret(expired or incorrect)AADSTS90002—TenantIdnot found
2. Validate the agent is running and reachable
200— the root health endpoint is reachable; this does not prove message processing or authentication works000or connection refused — agent is not running or wrong port
An unauthenticated POST /api/messages should return 401 when endpoint authorization is enabled. An empty JSON object is not a valid test activity, so do not expect a successful message response from posting {} with anonymous access. Use Agents Playground to verify the complete message flow.
3. Validate an OAuth connection name
OAuth connection names can only be tested end-to-end via:
Azure Portal → Your Bot Resource → Settings → OAuth Connection Settings → [your connection] → Test Connection
Local Testing with Agents Playground
The Agents Playground lets you test locally without deploying to Azure.
Install:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 7 Aug 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-plugins/agents-for-net/skills/agents-sdk-dotnet/SKILL.md
Popularity
- Repository stars
- 1,024
- Repository forks
- 331
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/agents/agents-sdk-dotnet)