Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 25 additions & 48 deletions 03-Azure/01-01-App Innovation/03_GHCPAppModernization/Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **App Modernization with GitHub Copilot**
# **Migrate & Modernize Applications with GitHub Copilot*#

- [**MicroHack introduction**](#microhack-introduction)
- [**MicroHack context**](#microhack-context)
Expand All @@ -8,75 +8,52 @@

# MicroHack introduction

This MicroHack teaches you to **drive application modernization with AI tooling**. You will use GitHub Copilot **Custom Agents**, **Skills**, and **MCP (Model Context Protocol)** servers, together with the GitHub Copilot **App Modernization** extensions, to modernize a legacy **.NET Framework** application and a legacy **Java / Spring Boot** application and move them to Azure.
This MicroHack guides you through migrating and modernizing real-world applications to Azure using **GitHub Copilot App Modernization**. You will work across two technology stacks — **.NET** and **Java (Spring Boot)** — and use the **modernize CLI** agent to assess, upgrade, and deploy applications at scale.

You start by building the AI foundation (agents, skills, MCP), then apply it to two real applications shipped in [`src/`](src/): **Contoso University** (.NET) and **Asset Manager** (Java).

This lab is not a full explanation of app modernization as a discipline. The following are recommended pre-reading:

- [GitHub Copilot app modernization for .NET](https://learn.microsoft.com/dotnet/core/porting/github-copilot-app-modernization-overview)
- [GitHub Copilot app modernization for Java](https://learn.microsoft.com/azure/developer/java/migration/migrate-github-copilot-app-modernization-for-java)
- [Model Context Protocol](https://modelcontextprotocol.io/)
The lab builds up progressively: you start by learning to author the AI foundation — **Custom Agents**, **Skills**, and **MCP** — then drive multi-repository assessment and framework upgrades from the command line, and finish by provisioning Azure infrastructure and deploying the modernized apps.

# MicroHack context

Modernization is a **multi-step, knowledge-heavy workflow**: assess → plan → execute → validate. AI coding agents are good at executing steps, but out of the box they lack a defined role and guardrails (Custom Agent), reusable domain knowledge (Skills), and tools to act on the real world (MCP servers). This MicroHack shows how those three pieces combine into a repeatable, gated modernization playbook — and then applies it to a .NET and a Java workload.
Modernizing legacy applications is often slow and error-prone: upgrading frameworks, resolving cloud readiness issues, replacing non-Azure dependencies, and standing up infrastructure all take significant manual effort. GitHub Copilot App Modernization uses AI to accelerate every phase of this journey — assessment, code upgrade, migration planning, and deployment — while keeping you in control through reviewable plans and pull requests.

> 📖 Concept primer: [docs/00-fundamentals.md](docs/00-fundamentals.md)
Across the challenges you will work with **PhotoAlbum** and **PhotoAlbum-Java** — a .NET and a Spring Boot sample app that you upgrade and deploy to Azure using the modernize CLI.

# Objectives

After completing this MicroHack you will:

- Explain how Custom Agents, Skills, and MCP fit together in an AI-assisted modernization workflow.
- Author a **Custom Agent** (`.agent.md`) with a phased, gated workflow and a least-privilege tool allow-list.
- Author a **Skill** (`SKILL.md`) that packages modernization domain knowledge with explicit `WHEN:` triggers.
- Configure **MCP servers** (`mcp.json`) that give the agent modernization tools (assessment, build, CVE checks, deployment).
- Run an end-to-end **assess → plan → execute → validate** loop to upgrade a .NET Framework app to **.NET 9** and a Java 8 / Spring Boot 2.x app to **Java 21 / Spring Boot 3.x**, and deploy to Azure.
- Know how to author a **Custom Agent** (`.agent.md`), package a reusable **Skill** (`SKILL.md`), and configure **MCP** (`mcp.json`), and understand the gated assess → plan → execute → validate loop.
- Understand how to use the GitHub Copilot App Modernization agent (modernize CLI).
- Know how to assess applications for cloud readiness and framework upgrade opportunities.
- Be able to upgrade .NET and Java applications to their latest framework versions.
- Understand how to run batch assessments across multiple repositories.
- Know how to create a cloud modernization plan, resolve cloud readiness issues, and migrate dependencies (for example, Oracle to PostgreSQL).
- Be able to provision Azure infrastructure and deploy modernized apps to Azure Container Apps.

# MicroHack challenges

## General prerequisites

This MicroHack has a few but important prerequisites.

In order to use the MicroHack time most effectively, the following should be completed prior to the session:

- **VS Code** (latest) with **GitHub Copilot** + **GitHub Copilot Chat** extensions, agent mode enabled
- **Visual Studio 2022** (latest) for the .NET challenge
- GitHub Copilot **App Modernization** extensions:
- *App Modernization for Java* (`vscjava.migrate-java-to-azure`)
- GitHub Copilot **app modernization for .NET** (Visual Studio "Modernize" flow)
- **Azure subscription** with **Contributor** on your resource group (for the deploy steps)
- **.NET SDK 9**, **Java 17/21 + Maven**, **Docker Desktop**

## Repository layout

```
03_GHCPAppModernization/
├── docs/
│ └── 00-fundamentals.md # Concepts: Custom Agents, Skills, MCP
├── templates/ # Generic + pre-tailored templates
│ ├── agents/ # Custom Agent templates (generic, .NET, Java)
│ ├── skills/ # Skill templates (generic, skill-creator, .NET, Java)
│ └── mcp/ # MCP server configuration template
├── challenges/ # Challenge instructions
├── walkthrough/ # Step-by-step solutions
└── src/ # Sample apps: ContosoUniversity (.NET), AssetManager (Java)
```
In order to use the MicroHack time most effectively, the following should be in place before you start:

- An **Azure Subscription** with permission to create resource groups and resources (Contributor or Owner).
- A **GitHub account** to fork the sample repositories.
- **Visual Studio Code** and/or a terminal with the **GitHub Copilot App Modernization agent (modernize CLI)** installed.
- **Docker Desktop**, **Git**, and the relevant SDKs (.NET and Java) installed locally.
- An active **GitHub Copilot** subscription.

## Challenges

* [Challenge 1 - Fundamentals: Custom Agents, Skills & MCP](challenges/challenge-01.md) **<- Start here**
* [Challenge 2 - Modernize a .NET Application](challenges/challenge-02.md)
* [Challenge 3 - Modernize a Java Application](challenges/challenge-03.md)
* [Challenge 1 - Fundamentals: Custom Agents, Skills & MCP for App Modernization](challenges/challenge-01.md) **<- Start here**
* [Challenge 2 - Batch Upgrade a Java App and a .NET App](challenges/challenge-02.md)
* [Challenge 3 - Modernize the Upgraded Apps and Deploy Them to Azure](challenges/challenge-03.md)
* [Finish](challenges/finish.md)

## Solutions - Spoilerwarning

* [Solution 1 - Fundamentals](./walkthrough/challenge-01/solution-01.md)
* [Solution 2 - .NET Application](./walkthrough/challenge-02/solution-02.md)
* [Solution 3 - Java Application](./walkthrough/challenge-03/solution-03.md)
* [Solution 1 - Fundamentals: Custom Agents, Skills & MCP for App Modernization](./walkthrough/challenge-01/solution-01.md)
* [Solution 2 - Batch Upgrade a Java App and a .NET App](./walkthrough/challenge-02/solution-02.md)
* [Solution 3 - Modernize the Upgraded Apps and Deploy Them to Azure](./walkthrough/challenge-03/solution-03.md)

# Contributors
* Nils Bankert [GitHub](https://github.com/nilsbankert); [LinkedIn](https://www.linkedin.com/in/nilsbankert/)
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Before pointing AI at a real .NET or Java application (challenges 2 and 3), you
* `.vscode/mcp.json` is configured and **MCP: List Servers** resolves the servers; the `appmod-*` tools are visible to the agent.
* When run, the agent respects the gates — it does **not** modify code before the assessment and plan are approved.

> Need the detailed, step-by-step walkthrough? See the [Challenge 1 Solution](../walkthrough/challenge-01/solution-01.md).

## Learning resources

* [Custom chat modes / agents in VS Code](https://code.visualstudio.com/docs/copilot/chat/chat-modes)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
# Modernize a .NET Application
# 2. Batch Upgrade a Java App and a .NET App

[Previous Challenge](challenge-01.md) - **[Home](../Readme.md)** - [Next Challenge](challenge-03.md)

## Goal

Modernize the Contoso University .NET Framework application to .NET 9 and deploy it to Azure App Service using GitHub Copilot’s AI-assisted tooling.
Use the GitHub Copilot App Modernization agent (modernize CLI) to assess and upgrade two applications at once — a Spring Boot (Java) app and an ASP.NET (.NET) app — bringing each to its latest framework version before any cloud migration work begins.

## Actions

* Fork `https://github.com/crgarcia12/migrate-modernize-lab`, clone your fork in Visual Studio 2022, and confirm the ContosoUniversity project builds.
* Use the Visual Studio “Modernize” flow to sign in to GitHub Copilot, select Claude Sonnet 4.5, and run the guided upgrade to .NET 9 until `dotnet-upgrade-report.md` is produced.
* Rerun “Modernize” to start “Migrate to Azure,” review the cloud readiness assessment, and resolve authentication findings by migrating from Windows AD to Microsoft Entra ID.
* Approve Copilot’s Azure App Service deployment workflow, wait for completion, and validate the site in Azure.
* Fork the two sample repositories into your own GitHub account:
* PhotoAlbum-Java (Spring Boot): `https://github.com/Azure-Samples/PhotoAlbum-Java`
* PhotoAlbum (.NET): `https://github.com/Azure-Samples/PhotoAlbum`
* Prepare a working directory and install the GitHub Copilot App Modernization agent (modernize CLI), which you will use end-to-end for assessment, upgrade, planning, and execution.
* Create a repositories config file so the CLI can operate on both apps in a single batch run.
* Run a **batch assessment** across both repositories, selecting the *Upgrade* and *Cloud readiness* analyses with full analysis coverage. Let the assessment run locally and wait for it to complete.
* Explore the assessment output: the **aggregated report** (overall recommendations, target platforms, upgrade paths, and migration waves) and the **per-repository reports** (detailed findings per app).
* Because a batch upgrade requires both repositories to share the same language, **upgrade each app individually**:
* Upgrade the .NET app to the version recommended in the assessment (.NET 10).
* Upgrade the Java app to the versions recommended in the assessment (Java 25 and Spring Boot 4.0).
* Confirm each upgrade reports success, then commit and push the changes to each respective forked repository.

> [!TIP]
> The assessment and each upgrade can take several minutes to run. Review the generated reports while you wait — they explain *why* each recommendation was made.

## Success criteria

* ContosoUniversity solution is forked, cloned, and builds locally.
* The application is upgraded from .NET Framework to .NET 9 with a generated upgrade report.
* Mandatory cloud readiness issues, including authentication migration to Microsoft Entra ID, are fully resolved.
* Azure App Service deployment completes successfully and the modernized app runs in Azure.
* Both PhotoAlbum-Java and PhotoAlbum are forked and available in your working directory.
* The modernize CLI is installed and configured to target both repositories from a config file.
* A batch assessment completes and produces both an aggregated report and per-repository reports.
* The .NET app is upgraded to .NET 10 and the Java app is upgraded to Java 25 / Spring Boot 4.0, each reporting a successful upgrade.
* All upgrade changes are committed and pushed to the respective remote repositories.

> Need the detailed, step-by-step walkthrough? See the [Challenge 2 Solution](../walkthrough/challenge-02/solution-02.md).

## Learning resources

* https://learn.microsoft.com/visualstudio/ide/visual-studio-github-copilot-extension
* https://learn.microsoft.com/dotnet/architecture/modernize-with-azure-containers/
* https://learn.microsoft.com/dotnet/core/migration/
* https://learn.microsoft.com/azure/app-service/quickstart-dotnetcore
* https://learn.microsoft.com/azure/active-directory/develop/quickstart-v2-aspnet-core-webapp
* [GitHub Copilot App Modernization – modernization agent quickstart](https://learn.microsoft.com/azure/developer/github-copilot-app-modernization/modernization-agent/quickstart)
* [Batch assess multiple repositories](https://learn.microsoft.com/azure/developer/github-copilot-app-modernization/modernization-agent/batch-assess)
* [Upgrade .NET applications](https://learn.microsoft.com/dotnet/core/porting/)
* [Spring Boot upgrade guidance](https://learn.microsoft.com/azure/developer/java/spring-framework/)
* [GitHub Copilot for VS Code](https://code.visualstudio.com/docs/copilot/overview)
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
# Modernize the Asset Manager Java Application
# 3. Modernize the Upgraded Apps and Deploy Them to Azure

[Previous Challenge](challenge-02.md) - **[Home](../Readme.md)** - [Finish](finish.md)
[Previous Challenge](challenge-02.md) - **[Home](../Readme.md)** - [Next Challenge](finish.md)

## Goal

Modernize the Asset Manager Spring Boot application for Azure by replacing AWS S3 dependencies with Azure services through the GitHub Copilot App Modernization workflow.
Take the two apps you upgraded in Challenge 2 and use the modernize CLI to create a cloud modernization plan, resolve cloud readiness issues, provision Azure infrastructure, and deploy both the Java and .NET applications to Azure.

## Actions

* Prepare the workstation by launching Docker Desktop, cloning the `migrate-modernize-lab` repo, and opening `src/AssetManager` in VS Code.
* Authenticate to GitHub, ensure the GitHub Copilot App Modernization extension (Claude Sonnet 4.5) is installed, and review prerequisite setup.
* Run `scripts\startapp.cmd` to validate the existing containers (RabbitMQ, Postgres) and confirm the app is reachable at `http://localhost:8080`.
* Launch the AppCAT assessment from the extension, track CLI installation, and wait for the identified cloud readiness issues and Java upgrade opportunities.
* Review the assessment insights, focusing on the AWS S3 to Azure Blob Storage migration recommendation and understanding the priority levels.
* Execute the guided migration task, inspect the generated `plan.md`, and continue the conversation to apply the proposed code refactoring.
* Monitor `progress.md`, Maven/Gradle changes, configuration updates, and Spring Cloud Azure versions as the migration proceeds.
* Allow the automated validation stages (CVE scans, builds, consistency checks, tests) to complete and remediate any issues flagged.
* Re-run `scripts\startapp.cmd`, verify Blob Storage integration locally, and test application functionality end-to-end.
* Optionally proceed with additional modernization tasks surfaced in the assessment to continue improving the workload.
* Using the modernize CLI, create a **cloud modernization plan** that targets both repositories from your config file. Instruct the plan to:
* Ignore any upgrade recommendations from the earlier assessment (the apps are already upgraded).
* Focus on resolving cloud readiness issues, provisioning Azure infrastructure for each app, and deploying each app to Azure.
* Migrate any OracleDB dependency to PostgreSQL if present.
* Review the generated plan and its tasks, then review and **merge the pull request** the agent produces.
* **Deploy the PhotoAlbum-Java app**: pull the latest plan branch, execute the plan with the modernize CLI, and wait for all tasks to finish. Validate the deployment by inspecting the created resource group in Azure and browsing to the Frontend Container App URL.
* **Deploy the PhotoAlbum (.NET) app**: pull the latest plan branch and execute the plan. If the plan does not provision infrastructure or deploy resources for this app, create a second, more explicit plan (for example, an "infra-setup-plan" that provisions Azure resources and deploys the app), then execute it.
* Validate the .NET deployment the same way — confirm the Azure resources and open the Frontend Container App URL.

> [!TIP]
> If a deployment step fails, use GitHub Copilot CLI to help diagnose and fix the error before retrying.

> [!NOTE]
> Plan generation and execution can each take a while (roughly 15–20 minutes per plan). This is a good point to take a break while the agent works.

## Success criteria

* Docker containers start successfully and the legacy app runs locally before changes.
* AppCAT completes with nine cloud readiness issues and four Java upgrade opportunities identified.
* The AWS S3 to Azure Blob Storage migration task executes with updated dependencies and configuration.
* All automated validation stages pass without unresolved issues.
* The modernized application starts locally using Azure Blob Storage with no storage errors.
* Migration activities are traceable through dedicated plan and progress artifacts for rollback readiness.
* A cloud modernization plan is generated for both repositories and its pull request is reviewed and merged.
* The PhotoAlbum-Java app is deployed to Azure, with its resources visible in a resource group and the Frontend Container App reachable.
* The PhotoAlbum (.NET) app is deployed to Azure — creating an explicit infrastructure/deployment plan where needed — with its resources visible and the Frontend Container App reachable.
* Both applications run successfully in Azure.

> Need the detailed, step-by-step walkthrough? See the [Challenge 3 Solution](../walkthrough/challenge-03/solution-03.md).

## Learning resources

* [GitHub Copilot for VS Code](https://code.visualstudio.com/docs/copilot/overview)
* [Azure SDK for Java](https://learn.microsoft.com/azure/developer/java/sdk/)
* [Migrate from AWS to Azure](https://learn.microsoft.com/azure/architecture/aws-professional/)
* [Azure Blob Storage for Java](https://learn.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-java)
* [Spring Cloud Azure](https://learn.microsoft.com/azure/developer/java/spring-framework/)
* [AppCAT Assessment Tool](https://learn.microsoft.com/azure/developer/java/migration/migration-toolkit-intro)
* [GitHub Copilot App Modernization – create a modernization plan](https://learn.microsoft.com/azure/developer/github-copilot-app-modernization/modernization-agent/quickstart)
* [Azure Container Apps documentation](https://learn.microsoft.com/azure/container-apps/)
* [Migrate Oracle to Azure Database for PostgreSQL](https://learn.microsoft.com/azure/postgresql/migrate/)
* [GitHub Copilot CLI](https://docs.github.com/copilot/github-copilot-in-the-cli)
* [Azure deployment best practices](https://learn.microsoft.com/azure/architecture/)
Loading
Loading