Agent-Assisted Migration to Forge v3¶
Forge v3 includes an AI-powered migration workflow driven by the migrate-to-v3 Agent Skill that automates the migration process from Forge v2 to v3. The SAIF MCP (Model Context Protocol) server runs alongside it, giving Copilot access to migration docs, template metadata, and CLI help.
The challenge: Manual migration involves dozens of file edits across .NET projects, Terraform modules, and pipeline configurationsβtime-consuming and error-prone.
The solution: The migrate-to-v3 Agent Skill gives Copilot migration knowledge, automated file discovery, and step-by-step execution guidance, reducing migration time from hours to minutes.
π Overview¶
| Aspect | Details |
|---|---|
| Goal | Migrate a Forge v2 application to v3 using AI-assisted automation via the migrate-to-v3 skill |
| Prerequisites | VS Code with Copilot plus the migration prerequisites |
| Time estimate | ~30-45 minutes (vs 2-4 hours manual) |
| Difficulty | Intermediate (requires understanding of git, pipelines, and basic troubleshooting) |
π§ Prerequisites¶
Before starting, ensure you have:
- β VS Code installed with the GitHub Copilot extension
- β Migration prerequisites: the .NET SDK, SAIF CLI, and Aspire CLI checks in the Forge v2 to v3 prerequisites, with minimum versions in Version Compatibility
- β Repository access: clone permissions for your application repository
- β Azure DevOps access: permissions to create and delete pipelines
π Instructions¶
Signposting: This guide walks through (1) updating prerequisites, (2) initializing the MCP server, (3) running the AI-assisted migration, and (4) cleaning up old pipelines.
Step 1: Update Prerequisites¶
Complete the Forge v2 to v3 prerequisites. That checklist owns the version checks and the saif doctor fix --self then saif doctor fix update sequence; Updating the SAIF CLI explains why the pause and new terminal matter.
Expected result: dotnet --version, saif --version, and aspire --version meet the minimums in Version Compatibility.
Step 2: Initialize MCP Server¶
The MCP server connects GitHub Copilot to the Forge platform documentation and migration tools.
- Close all VS Code windows and terminals so a new session picks up any
PATHchange from the Aspire CLI update - Open VS Code in your application repository root
- Open a new terminal in VS Code (
Ctrl+`) - Initialize MCP configuration:
Expected result: The host can use Forge's MCP tools and migration skill. Follow plugin setup and scope for configuration choices, then verify the installation before continuing.
Step 3: Run AI-Assisted Migration¶
Now you'll use Copilot's agent chat to execute the migration.
- Open Copilot Agent Chat in VS Code:
- Click the Copilot icon in the sidebar
-
Switch to the Agent Chat tab (not inline chat)
-
Select the agent model:
- Choose Claude Opus or Claude Sonnet for best results
-
Opus has stronger reasoning for complex migrations; Sonnet is faster
-
Ask the agent to run the migration workflow:
You can also mention the skill by name if needed, for example: "Use the migrate-to-v3 skill to migrate this repository to Forge v3." Once the forge plugin package is installed via saif agent init, Copilot can pick up that skill automatically from the task description and context.
What happens next:
- Copilot retrieves the Forge v2 to v3 Migration Guide
- Creates a local copy in
docs/migration/forge-v2-to-v3.mdfor progress tracking - Establishes a todo list from the migration task list (Tasks 0 to 10)
- Systematically executes each task:
- Discovers files that need updates
- Applies changes using multi-file edit operations
- Runs
dotnet buildafter each section - Updates progress checkboxes in the local migration doc
- Marks todos complete before moving to the next task
π‘ Tip: The agent will use
#runSubagentto parallelize file discovery tasks, significantly speeding up the migration.
Expected result: Copilot progressively completes every migration task, providing status updates after each section.
Step 4: Review and Test Migration¶
After Copilot completes the migration, verify the changes.
- Review the changes in git:
- Build the project:
- Run tests:
- Start the AppHost locally:
Expected result: All builds succeed, tests pass, and the Aspire dashboard loads successfully.
Step 5: Update Azure DevOps Pipelines¶
The final step is cleaning up old Okta-specific pipelines and creating the new unified auth pipelines.
β οΈ Important: Complete these steps in the Azure DevOps portalβthey cannot be automated via the MCP server.
Delete Legacy Pipelines¶
Navigate to Pipelines in your Azure DevOps project and delete these pipelines:
{project-id}-okta-appauth-pr{project-id}-okta-appauth{project-id}-okta-userauth-pr{project-id}-okta-userauth
How to delete:
- Go to the pipeline in Azure DevOps
- Click the β― (More actions) menu
- Select Delete
- Confirm deletion
Create New Auth Pipelines¶
Create two new pipelines using the updated YAML files:
{project-id}-auth-prβ PR validation for auth infrastructure- Source:
.azdo/azure-pipelines-auth-pr.yml -
Trigger: Pull requests affecting
infra/auth/** -
{project-id}-authβ Production deployment for auth infrastructure - Source:
.azdo/azure-pipelines-auth.yml - Trigger: Manual (same as existing pipelines)
How to create:
- In Azure DevOps, go to Pipelines β New pipeline
- Select Azure Repos Git
- Choose your repository
- Select Existing Azure Pipelines YAML file
- Browse to the YAML file path
- Click Continue β Save (not Run)
- Rename the pipeline to match the naming convention
Expected result: Four legacy Okta pipelines deleted, two new unified auth pipelines created.
β Verify It Worked¶
After completing all steps, verify the migration:
- Check version compatibility:
# All .csproj files should target net10.0
Select-String -Path "**/*.csproj" -Pattern "<TargetFramework>net10.0</TargetFramework>"
- Verify Aspire SDK:
# AppHost project should use Aspire.AppHost.Sdk/13.1.0
Get-Content "src/*AppHost/*.csproj" | Select-String "Aspire.AppHost.Sdk"
-
Check folder structure:
-
β
infra/api/exists (renamed frominfra/app/) - β
infra/auth/corp/exists (new for Entra ID) -
β
infra/auth/ext/contains Okta configuration -
Confirm pipeline updates:
-
β
.azdo/azure-pipelines-api.ymlreferencesazure-dotnet-api-v3.yml@templates - β
Pipeline templates reference
refs/heads/releases/v3 - β New auth pipelines exist in Azure DevOps
Success indicator:
π― Key Takeaways¶
After completing this guide, you will have:
- β Upgraded your application to .NET 10, Aspire 13, and Forge 3.0 packages
- β Restructured infrastructure to support dual authentication (Entra ID + Okta)
- β
Updated pipelines to use v3 templates with
refs/heads/releases/v3 - β Cleaned up legacy Okta-specific pipelines
- β Experienced AI-assisted migration with the SAIF MCP server
π Troubleshooting¶
Problem: MCP server not found¶
Cause: SAIF CLI is outdated or MCP configuration wasn't initialized.
Solution:
- Update the SAIF CLI and its tools with the sequence in Updating the SAIF CLI.
- Reinitialize MCP with
saif agent init. - Restart VS Code.
Problem: Copilot doesn't pick up the migrate-to-v3 skill¶
Cause: The Forge plugin package is not registered, VS Code has stale plugin settings loaded, or the request did not clearly describe the migration task.
Solution:
- Verify the Forge Agent Plugins are registered:
- User scope (default): check the configuration files in the plugin scope table, then follow plugin verification.
- Project scope (
--local): check<repo>/.github/copilot/settings.json. - Restart VS Code to pick up the updated plugin settings
- In Agent Chat, ask explicitly for the migration workflow, for example: "Use the
migrate-to-v3skill to migrate this repository to Forge v3." - If the agent still does not pick it up, confirm the
forgeplugin package is installed and review the package manifest for shipped skill names. - If plugin registration still looks wrong, run
saif agent mcpmanually and check for errors
Problem: Migration stops partway through¶
Cause: Copilot encountered an unexpected file structure or build error.
Solution:
- Check the Copilot chat for error messages
- Review the last completed todo item
- Manually complete the failed step using the manual migration guide
- Ask Copilot to resume from the next task: "Continue with the next migration task"
Problem: Build fails after migration¶
Cause: Package restore issue or stale build artifacts.
Solution:
# Clear NuGet cache and rebuild
dotnet nuget locals all --clear
dotnet clean
dotnet restore
dotnet build
If errors persist, compare your changes to the manual migration guide to identify missing steps.
π Example¶
Complete Example: Migrating IT-API-EXP-EXAMPLE¶
This example shows the complete workflow for migrating an experience API.
# 1. Verify prerequisites against Version Compatibility
dotnet --version
saif --version
aspire --version
# 2. Close all terminals and VS Code windows
# 3. Reopen VS Code in repository root
cd C:\repos\it-api-exp-example
code .
# 4. Initialize MCP in VS Code terminal
saif agent init
# 5. Open Copilot Agent Chat
# - Click Copilot icon β Agent Chat tab
# - Select Claude Opus model
# - Ask: "Migrate this repository to Forge v3 using the standard migrate-to-v3 workflow."
# 6. Monitor progress
# Copilot reports each task in the migration task list as it completes,
# for example: β
Task 0: Baseline Build complete
# 7. Review changes
git status
git diff
# 8. Test locally
dotnet build
dotnet test
cd src/Example.AppHost
aspire run
# 9. Update Azure DevOps pipelines
# - Delete: it-api-exp-example-okta-appauth, it-api-exp-example-okta-appauth-pr
# - Delete: it-api-exp-example-okta-userauth, it-api-exp-example-okta-userauth-pr
# - Create: it-api-exp-example-auth-pr (from .azdo/azure-pipelines-auth-pr.yml)
# - Create: it-api-exp-example-auth (from .azdo/azure-pipelines-auth.yml)
# 10. Commit and create PR
git checkout -b migrate-to-forge-v3
git add .
git commit -m "Migrate to Forge v3.0"
git push origin migrate-to-forge-v3
Result:
- Migration completed in ~35 minutes
- All tests passing
- PR ready for review with automated changes
π Related Documentation¶
- Forge v2 to v3 Migration Guide - Full manual migration steps
- Version Compatibility Matrix - Supported versions for Forge 3.0
- SAIF CLI Reference - MCP commands and capabilities
π Next Steps¶
After completing the migration:
| Task | Guide |
|---|---|
| Configure Entra ID app roles and scopes | Security Configuration |
| Update TypeSpec definitions for auth | Security Configuration |
| Test authentication in local environment | Create JWT for Testing APIs |
| Deploy to development environment | Run your updated pipelines in Azure DevOps |
| Review breaking changes | Forge 3.0 Release Notes |
π€ About the SAIF MCP Server¶
The SAIF MCP (Model Context Protocol) server is a built-in feature of the SAIF CLI that provides AI assistants like GitHub Copilot with direct access to:
- Forge documentation β Migration guides, how-tos, and reference material
- Template information β Complete template metadata and parameter descriptions
- CLI commands β Searchable command help and examples
Agent Skills are a separate, related piece: they ship in the forge and forge-planning Agent Plugins packages (not the MCP server itself) and provide the shipped workflows and domain guidance the model can invoke from task context.
How it works:
saif agent initregisters the shared Forge MCP server plus the Forge Agent Plugins packages (skills) β by default machine-wide via~/.copilot/settings.json; pass--localto also write repo-scoped plugin settings into.github/copilot/settings.json- The MCP server runs locally and connects to GitHub Copilot via VS Code
- Copilot can use the shipped Forge MCP tools directly, and can invoke Agent Skills installed by the same
saif agent initcall - The server retrieves documentation from the live Forge docs site and caches it locally
Agent Skills used in this guide:
migrate-to-v3β Standard Forge v2 to v3 migration workflow orchestrationsaif-cliβ SAIF CLI and Forge MCP guidance forsaif agent init, command discovery, and migration-doc lookuptroubleshootβ Diagnostic guidance if the migration hits version drift, build issues, or other Forge-specific blockers
For the shipped skill inventory, see the package manifest.