Microsoft Agent Framework Quick-Start for Web API
Build AI-powered Web API apps in minutes with Microsoft Agent Framework.
Microsoft Agent Framework Quick-Start for Web API is a Visual Studio template for rapidly building C# Clean Architecture APIs with integrated AI features. It provides a ready-to-use ASP.NET Core Web API backend with SQL Server persistence.

Before You Start
- Install template from Visual Studio Marketplace.
- Create solution in Visual Studio from Agent Framework Quick-Start.
- Open Windows Terminal in the generated solution root.
Install prerequisites:
winget install --id Microsoft.VisualStudio.Community --override "--quiet --add Microsoft.Visualstudio.Workload.Azure --add Microsoft.VisualStudio.Workload.Data --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb"
winget install Microsoft.DotNet.SDK.10 --silent
dotnet dev-certs https --trust
dotnet tool install --global dotnet-ef
SQL Server:
- SQL Express is fine for local development.
- Developer Edition is optional for full SQL Server features.
SQL Server downloads
Setup Mode 1: First-Time EEID Setup (Recommended)
Use this mode when you do not already have app registrations for this solution.
1. Create EEID app registrations and write secrets via script
pwsh -File ./.azure/scripts/entra/New-EntraAppRegistrations.ps1 -EntraInstanceUrl "https://your-tenant-name.ciamlogin.com" -TenantId "<your-tenant-id>" -WebAppRegistrationName "myproduct-web-dev-001" -ApiAppRegistrationName "myproduct-api-dev-001" -WebProjectPath "./Presentation.Web" -ApiProjectPath "./Presentation.Api" -WebRedirectUri "https://localhost:6195/signin-oidc" -WebLogoutUri "https://localhost:6195/signout-callback-oidc"
Important:
- WebRedirectUri and WebLogoutUri must match the HTTPS URL/port in Presentation.Web Properties/launchSettings.json.
- Grant admin consent when prompted.
2. Set AI provider and secrets
Azure OpenAI default:
cd Presentation.Api
dotnet user-secrets set "AgentProvider:Kind" "AzureOpenAI"
dotnet user-secrets set "AzureOpenAI:ChatCompletionModelId" "gpt-4"
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR_ENDPOINT.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR_API_KEY"
cd ../Tests.Integration
dotnet user-secrets init
dotnet user-secrets set "AzureOpenAI:ChatCompletionModelId" "gpt-4"
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR_ENDPOINT.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR_API_KEY"
OpenAI fallback:
cd ../Presentation.Api
dotnet user-secrets set "AgentProvider:Kind" "OpenAI"
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
cd ../Tests.Integration
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
3. Create or update SQL schema
cd ..
dotnet ef database update --project .\Infrastructure.SqlServer\Infrastructure.SqlServer.csproj --startup-project .\Presentation.Api\Presentation.Api.csproj --context AgentFrameworkContext --connection "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=AgentFramework;Min Pool Size=3;MultipleActiveResultSets=True;Trusted_Connection=Yes;TrustServerCertificate=True;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"
4. Run and debug
dotnet run --project Presentation.Api/Presentation.Api.csproj
Or press F5 in Visual Studio after setting startup project(s).
Setup Mode 2: Re-Setup Existing EEID + AI Provider
Use this mode when your EEID app registrations already exist and you just need to rehydrate local secrets quickly.
Paste the full script blocks below in Windows Terminal.
1. Full API secrets block
cd Presentation.Api
dotnet user-secrets init
dotnet user-secrets set "EntraExternalId:Instance" "https://your-tenant-name.ciamlogin.com"
dotnet user-secrets set "EntraExternalId:TenantId" "TENANT_ID"
dotnet user-secrets set "EntraExternalId:ClientId" "API_CLIENT_ID"
dotnet user-secrets set "EntraExternalId:ValidateAuthority" "true"
dotnet user-secrets set "ApplicationInsights:ConnectionString" "AZURE_MONITOR_CONNECTION_STRING"
2. Full Web secrets block
cd ../Presentation.Web
dotnet user-secrets init
dotnet user-secrets set "BackendApi:ClientId" "API_CLIENT_ID"
dotnet user-secrets set "EntraExternalId:Instance" "https://your-tenant-name.ciamlogin.com"
dotnet user-secrets set "EntraExternalId:TenantId" "TENANT_ID"
dotnet user-secrets set "EntraExternalId:ClientId" "WEB_CLIENT_ID"
dotnet user-secrets set "EntraExternalId:PasswordResetUrl" "https://your-tenant-name.ciamlogin.com/TENANT_ID/oauth2/v2.0/authorize?p=B2C_1_passwordreset"
dotnet user-secrets set "EntraExternalId:ValidateAuthority" "true"
dotnet user-secrets set "EntraExternalId:ClientSecret" "WEB_CLIENT_SECRET"
dotnet user-secrets set "ApplicationInsights:ConnectionString" "AZURE_MONITOR_CONNECTION_STRING"
3. Full AI secrets block
Azure OpenAI:
cd ../Presentation.Api
dotnet user-secrets set "AgentProvider:Kind" "AzureOpenAI"
dotnet user-secrets set "AzureOpenAI:ChatCompletionModelId" "gpt-4"
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR_ENDPOINT.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR_API_KEY"
cd ../Tests.Integration
dotnet user-secrets init
dotnet user-secrets set "AzureOpenAI:ChatCompletionModelId" "gpt-4"
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR_ENDPOINT.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR_API_KEY"
OpenAI:
cd ../Presentation.Api
dotnet user-secrets set "AgentProvider:Kind" "OpenAI"
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
cd ../Tests.Integration
dotnet user-secrets init
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
4. SQL update and debug
cd ..
dotnet ef database update --project .\Infrastructure.SqlServer\Infrastructure.SqlServer.csproj --startup-project .\Presentation.Api\Presentation.Api.csproj --context AgentFrameworkContext --connection "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=AgentFramework;Min Pool Size=3;MultipleActiveResultSets=True;Trusted_Connection=Yes;TrustServerCertificate=True;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"
dotnet run --project Presentation.Api/Presentation.Api.csproj
Then press F5 in Visual Studio.
Features
- Chat completions
- Speech and image workflows
- Extensible plugin model
- SQL-backed persistence