|
| 1 | +--- |
| 2 | +title: Migrate .NET apps to Azure using GitHub Copilot app modernization in Copilot CLI |
| 3 | +description: Overview of migrating .NET applications to Azure using GitHub Copilot app modernization in Copilot CLI. |
| 4 | +ms.topic: concept-article |
| 5 | +ms.custom: devx-track-dotnet |
| 6 | +ms.date: 11/11/2025 |
| 7 | +author: alexwolfmsft |
| 8 | +ms.author: alexwolf |
| 9 | +ms.reviewer: jessiehuang |
| 10 | +--- |
| 11 | + |
| 12 | +# Migrate .NET apps to Azure using GitHub Copilot app modernization in Copilot CLI |
| 13 | + |
| 14 | +## Overview |
| 15 | + |
| 16 | +Learn how to migrate .NET applications to Azure with **GitHub Copilot app modernization** in the [**Copilot CLI**](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli). |
| 17 | + |
| 18 | +>[!NOTE] |
| 19 | +> GitHub Copilot CLI is available in the GitHub Copilot Pro, GitHub Copilot Pro+, GitHub Copilot Business, and GitHub Copilot Enterprise plans. |
| 20 | +> If you receive Copilot through an organization, an admin must enable the Copilot CLI policy in the organization settings. |
| 21 | +
|
| 22 | +## Why use Copilot CLI with app modernization |
| 23 | + |
| 24 | +- Run modernization tasks from the terminal - no need to switch to an IDE. |
| 25 | +- Use interactive (human-in-the-loop) and batch workflows. |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +- [Install Copilot CLI](https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli). |
| 30 | +- A GitHub Copilot subscription. See [Copilot plans](https://github.com/features/copilot/plans?ref_product=copilot). |
| 31 | +- [Install the .NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0). |
| 32 | + |
| 33 | +## Getting started |
| 34 | + |
| 35 | +1. In a terminal, navigate to the .NET project folder containing the code you want to work on. |
| 36 | +1. Run `copilot` to start Copilot CLI. |
| 37 | + |
| 38 | + ```bash |
| 39 | + copilot |
| 40 | + ``` |
| 41 | + |
| 42 | + :::image type="content" source="./media/copilot-cli-entrance.png" lightbox="./media/copilot-cli-entrance.png" alt-text="Screenshot of app modernization entrance in Copilot CLI."::: |
| 43 | + |
| 44 | + Copilot asks you to confirm that you trust the files in this folder. For details, see [Using Copilot CLI](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli#trusted-directories). |
| 45 | + |
| 46 | + Choose one of the options: |
| 47 | + |
| 48 | + - **Yes, proceed**: Copilot can work with the files in this location for this session only. |
| 49 | + - **Yes, and remember this folder for future sessions**: Trust the files in this folder for this and future sessions. You won't be asked again when you start Copilot CLI here. Only choose this option if you are sure it will always be safe for Copilot to work with files in this location. |
| 50 | + - **No, exit (Esc)**: End the Copilot CLI session. |
| 51 | + |
| 52 | +1. Add MCP servers. Run `/mcp add` in Copilot CLI using the configuration below. For example, to add the .NET migration MCP server: |
| 53 | + |
| 54 | + ```bash |
| 55 | + /mcp add DotNetAppModMcpServer-migrate |
| 56 | + ``` |
| 57 | + |
| 58 | + Fill the fields as follows: |
| 59 | + |
| 60 | + - Server Type: Local |
| 61 | + - Command: `dnx Microsoft.AppModernization.McpServer.DotNet.Migration --yes --source https://api.nuget.org/v3/index.json` |
| 62 | + - Environment Variables: Leave empty. |
| 63 | + - Tools: Use the default value `*`. |
| 64 | + |
| 65 | + Or update the `~/.config/mcp-config.json` file with the following information. For details, see [Add an MCP server](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli#add-an-mcp-server). |
| 66 | + |
| 67 | + ```json |
| 68 | + { |
| 69 | + "mcpServers": { |
| 70 | + "DotNetAppModMcpServer-migrate": { |
| 71 | + "type": "local", |
| 72 | + "command": "dnx", |
| 73 | + "tools": [ |
| 74 | + "*" |
| 75 | + ], |
| 76 | + "args": [ |
| 77 | + "Microsoft.AppModernization.McpServer.DotNet.Migration", |
| 78 | + "--yes", |
| 79 | + "--source", |
| 80 | + "https://api.nuget.org/v3/index.json" |
| 81 | + ] |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | + ``` |
| 86 | + |
| 87 | + Run `/mcp show` to confirm the MCP server configuration. |
| 88 | + |
| 89 | + ```bash |
| 90 | + /mcp show |
| 91 | + ``` |
| 92 | + |
| 93 | +1. Run the migration task in Copilot CLI. |
| 94 | + |
| 95 | + Describe your migration scenario in Copilot CLI to migrate your .NET app to Azure. |
| 96 | + Use a prompt like *migrate from X to Y* for any migration task. |
| 97 | + Copilot CLI supports predefined migration scenarios that follow Microsoft best practices. For details, see [migration tasks](predefined-tasks.md). |
| 98 | + |
| 99 | + Example prompts: |
| 100 | + |
| 101 | + ```text |
| 102 | + Migrate this app from local file I/O to Azure Blob Storage |
| 103 | + Migrate this app from local SQL Server to Azure SQL Database with managed identity |
| 104 | + Migrate this app from file-based logging to OpenTelemetry |
| 105 | + ``` |
| 106 | + |
| 107 | + The migration task runs and shows progress in Copilot CLI. |
| 108 | + |
| 109 | + :::image type="content" source="./media/migrate-details.png" lightbox="./media/migrate-details.png" alt-text="Screenshot of a .NET migration task progress details in Copilot CLI."::: |
| 110 | + |
| 111 | + After migration, view the summary: |
| 112 | + |
| 113 | + :::image type="content" source="./media/migrate-summary.png" lightbox="./media/migrate-summary.png" alt-text="Screenshot of the .NET migration summary in Copilot CLI."::: |
| 114 | + |
| 115 | +## Provide feedback |
| 116 | + |
| 117 | +Share feedback about GitHub Copilot CLI using the [GitHub Copilot CLI feedback form](https://aka.ms/AM4DFeedback). |
| 118 | + |
| 119 | +## Reference |
| 120 | + |
| 121 | +- [Using GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli#using-copilot-cli) |
0 commit comments