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, .NET 10 SDK, SAIF CLI 3.0+, Aspire 13.1+ |
| 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
- β .NET 10 SDK β Download from dotnet.microsoft.com/download/dotnet/10.0
- β
SAIF CLI 3.0+ β Verify with
saif --version - β
Aspire 13.1+ β Verify with
aspire --version - β Repository access β Clone permissions for your application repository
- β Azure DevOps access β Permissions to create/delete pipelines
π‘ Tip: If your SAIF CLI or Aspire versions are outdated, run
saif doctor fix --selfto update the CLI, thensaif doctor fixto update Aspire and other tools, with a 20-second pause between runs to ensure all updates complete.
π 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¶
Before starting the migration, ensure all tools are up to date.
# Verify current versions
dotnet --version # Should be 10.0.x
saif --version # Should be 3.0.x
aspire --version # Should be 13.1.x
# If outdated, update SAIF CLI and Aspire
saif doctor fix --self
Start-Sleep -Seconds 20
saif doctor fix
Start-Sleep -Seconds 20
# Verify updates
saif --version
aspire --version
Expected result: All version checks pass with minimum required versions.
β οΈ Important: Close all open terminals and VS Code instances after updating to ensure the new Aspire CLI path is loaded.
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 to pick up the updated Aspire path
- Open VS Code in your application repository root
- Open a new terminal in VS Code (
Ctrl+`) - Initialize MCP configuration:
Expected result: By default this registers Forge Agent Plugins in your user profile (machine-wide) β no files are written into your repository. Pass saif agent init --local instead if you specifically want repo-scoped plugin settings written into .github/copilot/settings.json (shared with collaborators if committed).
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 with 10 migration tasks
- 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 all 10 migration tasks, 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 SAIF CLI
saif doctor fix --self
Start-Sleep -Seconds 20
saif doctor fix
# Reinitialize MCP
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
~/.copilot/settings.json(used by GitHub Copilot CLI and the GitHub Copilot app), and if you're verifying VS Code marketplace discovery check the user profilesettings.jsonpath in the scope targets table. You can also re-runsaif agent initand confirm it reports "already up to date". - 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 Agent Skills inventory for the shipped skill names and summaries - 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
dotnet --version # 10.0.101
saif --version # 3.0.5
aspire --version # 13.1.0
# 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 outputs:
# β
Task 0: Baseline Build complete
# β
Task 1: .NET 10 SDK verified
# β
Task 2: SAIF Tools updated
# β
Task 3: dotnet-outdated-tool installed
# β
Task 4: .NET 10 Upgrade complete
# β
Task 5: Package Updates complete
# β
Task 6: AppHost Changes complete
# β
Task 7: Infrastructure Restructuring complete
# β
Task 8: Terraform Variable Casing complete
# β
Task 9: Entra ID Migration complete
# β
Task 10: Pipeline Updates 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 full shipped skill inventory, see Agent Skills.