AI-powered web application with Entra ID authentication and Foundry Agent Service integration. Deploy to Azure Container Apps with a single command.
# Clone or initialize from GitHub template
azd init -t microsoft-foundry/foundry-agent-webapp
# Deploy everything
azd up # Full deployment: ~10-12 minutesAlternative: Use GitHub's "Use this template" button or clone directly:
git clone https://github.com/microsoft-foundry/foundry-agent-webapp.git
cd foundry-agent-webapp
azd upThe azd up command:
- Discovers AI Foundry resources in your subscription
- Creates Microsoft Entra ID app registration (via Bicep) and Azure infrastructure (ACR, Container Apps)
- Builds and deploys your application
- Opens browser to your deployed app
Local Development: http://localhost:5173 (frontend), http://localhost:8080 (backend)
Production: https://.azurecontainerapps.io
- PowerShell 7+ -
winget install Microsoft.PowerShell - Azure Developer CLI (azd) -
winget install microsoft.azd - Azure CLI -
winget install Microsoft.AzureCLI - Docker Desktop (optional) - https://docs.docker.com/desktop/install/windows-install/
- .NET 9 SDK - https://dot.net
- Node.js 18+ - https://nodejs.org
- PowerShell 7+ -
brew install powershellor download - Azure Developer CLI (azd) -
brew tap azure/azd && brew install azdorcurl -fsSL https://aka.ms/install-azd.sh | bash - Azure CLI -
brew install azure-cliorcurl -L https://aka.ms/InstallAzureCli | bash - Docker Desktop (optional) -
brew install --cask dockeror download - .NET 9 SDK - https://dot.net
- Node.js 18+ -
brew install nodeor https://nodejs.org
Homebrew not installed? Commands work without Homebrew using direct installers. The deployment script (
azd up) checks for Homebrew and provides appropriate installation instructions.
- PowerShell 7+ - https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-linux
- Azure Developer CLI (azd) -
curl -fsSL https://aka.ms/install-azd.sh | bash - Azure CLI - https://learn.microsoft.com/cli/azure/install-azure-cli-linux
- Docker Engine (optional) - https://docs.docker.com/engine/install/
- .NET 9 SDK - https://dot.net
- Node.js 18+ - https://nodejs.org
- Azure Subscription with Contributor role
- Bicep CLI - Installed automatically with
azd, or manually:az bicep install - Microsoft Foundry Resource - Create at https://ai.azure.com with at least one agent
Note: Docker is optional. If not installed,
azdautomatically uses Azure Container Registry cloud build for deployment.
If your organization uses a custom npm registry, add .npmrc to frontend/ directory:
registry=https://your-registry.example.com/
//your-registry.example.com/:_authToken=${NPM_TOKEN}Note: .npmrc is automatically copied during Docker builds. Don't commit authentication tokens.
If your organization requires a Service Management Reference for Entra ID app registrations, set it before deploying:
For non-interactive environments (CI/CD), set it before deploying:
azd env set ENTRA_SERVICE_MANAGEMENT_REFERENCE "<guid-from-admin>"See deployment/hooks/README.md for more organization-specific configuration options.
The workspace includes optimized VS Code configuration for AI-assisted development:
| Task | Description | Port |
|---|---|---|
Backend: ASP.NET Core API |
dotnet watch run with hot reload |
8080 |
Frontend: React Vite |
npm run dev with HMR (auto-installs deps) |
5173 |
Start Dev (VS Code Terminals) |
Starts both in parallel (default build task) | - |
Install Frontend Dependencies |
npm install --legacy-peer-deps (runs automatically) |
- |
Hot Reload Workflow:
- Backend: Edit C# → Save → .NET auto-recompiles → Check terminal for errors
- Frontend: Edit TypeScript/React → Save → Browser updates instantly (HMR)
- No restarts needed - just edit, save, and test
AI Agent Benefits: Server logs are visible in VS Code terminals, allowing AI agents to:
- See compilation errors and warnings
- Monitor request handling
- Debug issues without screenshots
| Configuration | Description |
|---|---|
.NET: Launch Backend |
Debug ASP.NET Core API with C# Dev Kit |
.NET: Attach to Backend |
Attach to running dotnet watch process |
Chrome: Frontend |
Debug React app in Chrome with source maps |
Edge: Frontend |
Debug React app in Edge |
Full Stack Debug |
Launch backend + Chrome together |
- GitHub Copilot - Code generation uses instruction files (
github.copilot.chat.codeGeneration.useInstructionFiles: true) - Agent Customization - Agent customization skill enabled (
chat.agentCustomizationSkill.enabled: true) - Skills - On-demand loading from
.github/skills/for efficient context - Terminal Scrollback - Limited to 500 lines to prevent overwhelming AI context
- Markdown Linting - Disabled to prevent noise from instruction files
azd up automatically discovers your Foundry resource, project, and agent:
- 1 resource found: Auto-selects and configures RBAC
- Multiple resources found: Prompts you to select which one to use
- RBAC: Automatically grants the Container App's managed identity "Cognitive Services User" role
Change AI Foundry resource:
# Option 1: Let azd discover and prompt for selection
azd provision # Re-runs discovery, updates RBAC
# Option 2: Manually configure then provision
azd env set AI_FOUNDRY_RESOURCE_GROUP <resource-group>
azd env set AI_FOUNDRY_RESOURCE_NAME <resource-name>
azd provision # Updates RBAC for new resourceList and switch agents (requires prior azd up):
# List all agents in configured project
.\deployment\scripts\list-agents.ps1
# Switch to different agent (in same resource)
azd env set AI_AGENT_ID <agent-name>
# No provision needed - RBAC already grants access to all agents in the resource💡
azd provision(orazd up) automatically regenerates.envfiles and updates RBAC assignments when configuration changes.
# Run the compound task via Command Palette (Ctrl+Shift+P):
# "Tasks: Run Task" → "Start Dev (VS Code Terminals)"
# Or press Ctrl+Shift+B (default build task)
# Servers run in VS Code terminal panel with visible logs
# AI agents can read logs via get_terminal_output# Start local development (spawns separate terminal windows)
.\deployment\scripts\start-local-dev.ps1- React: Hot Module Replacement (HMR) - instant browser updates
- C#: Watch mode - auto-recompiles on save, check terminal for errors
- Test at: http://localhost:5173
# Deploy code changes to Azure
azd deploy # 3-5 minutesFrontend: React 19 + TypeScript + Vite
Backend: ASP.NET Core 9 Minimal APIs
Authentication: Microsoft Entra ID (PKCE flow)
AI Integration: Foundry Agent Service v2 Agents API (Azure.AI.Projects SDK)
Deployment: Single container, Azure Container Apps
Local Dev: Native (no Docker required)
- Office Documents: DOCX, PPTX, and XLSX files are not supported for upload. Use PDF, images, or plain text files instead.
- Beta SDK: This application uses Azure.AI.Projects SDK v1.2.0-beta.5. Some features may change before general availability.
- npm Peer Dependencies: React 19 has peer dependency conflicts with some packages. If adding packages that have peer dependencies (like
yjsfor@lexical/yjs), you must add them explicitly topackage.json. Runnpm cilocally to verify before committing.
For tracking feature updates, see issue #14.
See .github/copilot-instructions.md for complete command reference and development workflow.
| Command | Purpose | Duration |
|---|---|---|
azd up |
Initial deployment (infra + code) | 10-12 min |
azd deploy |
Deploy code changes only | 3-5 min |
.\deployment\scripts\start-local-dev.ps1 |
Start local development | Instant |
.\deployment\scripts\list-agents.ps1 |
List agents in your project | Instant |
azd provision |
Re-deploy infrastructure / update RBAC | 2-3 min |
azd down --force --purge |
Delete all Azure resources | 2-3 min |
ARCHITECTURE-FLOW.md- State machines, data flow diagrams, and SSE event mappingbackend/README.md- ASP.NET Core API setup and configurationfrontend/README.md- React frontend developmentinfra/README.md- Azure infrastructure overviewdeployment/README.md- Deployment scripts and hooks
This repository uses VS Code's Agent Skills feature for on-demand context loading:
.github/copilot-instructions.md- Architecture overview (always loaded).github/skills/- Domain-specific guidance loaded when relevant:understanding-architecture- State machines, SSE events, data flowdeploying-to-azure- Deployment commands and troubleshootingwriting-csharp-code- C#/ASP.NET Core patternswriting-typescript-code- TypeScript/React patternswriting-bicep-templates- Bicep infrastructure patternsimplementing-chat-streaming- SSE streaming patternstroubleshooting-authentication- MSAL/JWT debuggingresearching-azure-ai-sdk- SDK research workflowtesting-with-playwright- Browser testing workflowsyncing-mcp-servers- MCP server config synchronizationtesting-cli-compatibility- CLI compatibility validationwriting-unit-tests-csharp- C#/MSTest unit test patternswriting-unit-tests-typescript- TypeScript/Vitest unit test patternsvalidating-ui-features- UI feature validation procedurescommitting-code- Commit message format and conventional commit workflowreviewing-documentation- Documentation audit checklists and quality standardstriaging-issues- Issue triage workflow, priority definitions, and report formatplanning-features- Structured plan template for feature implementation
.github/hooks/— Agent hook system (e.g., commit gate) for enforcing workflows
This template deploys the following Azure resources:
- Azure Container Apps - Serverless container hosting (0.5 vCPU, 1GB RAM, scale-to-zero enabled)
- Azure Container Registry - Private container image storage (Basic tier)
- Log Analytics Workspace - Application logging and monitoring
- Managed Identity - System-assigned identity with RBAC to Foundry resource
Local development requires no Azure resources - runs natively without Docker or cloud dependencies.
├── backend/WebApp.Api/ # ASP.NET Core API + serves frontend
├── frontend/ # React + TypeScript + Vite
├── infra/ # Bicep infrastructure templates
├── deployment/
│ ├── hooks/ # azd lifecycle automation
│ ├── scripts/ # User commands
│ └── docker/ # Multi-stage Dockerfile
└── .github/
├── copilot-instructions.md # Architecture overview (always loaded)
├── hooks/ # Agent hooks (commit gate, custom policies)
├── skills/ # On-demand AI assistant guidance
│ ├── understanding-architecture/
│ ├── deploying-to-azure/
│ ├── writing-csharp-code/
│ ├── writing-typescript-code/
│ └── ... # 18 skills total
└── skills/ # 18 on-demand AI assistant skills