A practical introduction · 14 slides
GitHub Copilot
modernization agent
From understanding legacy code to proving a migration works. One governed workflow, applied to two real applications in this repository.
Practice repository, not a completed migration or a production template.
Assess
Understand the current application.
Plan
Choose targets and approve the path.
Execute
Transform, validate, and review.
01 / The agent
More than a code-editing conversation.
The Modernize CLI combines deterministic orchestration with Copilot-powered analysis and transformations.
Understand
Analyze code, configuration, dependencies, upgrade opportunities, and cloud readiness.
Structure
Turn an approved goal into ordered tasks, compatibility decisions, and measurable success criteria.
Act
Apply transformations, validate builds, remediate supported findings, and create a traceable change history.
Interactive TUI for guided decisions. Headless CLI for repeatable automation. Reusable skills can encode organizational standards.
02 / This repository
Two stacks. One behavior contract.
Independent blog engines with equivalent publishing, authentication, and moderation workflows.
.NET Framework 4.7.2
- Classic ASP.NET MVC 5 / Razor.
- EF6, ASP.NET Identity, and OWIN.
- Non-SDK project and persistent LocalDB.
Intentionally legacy. Build and run on Windows with Framework MSBuild and IIS Express.
Spring MVC 5
- Java 11, Spring Security 5, Hibernate 5.
- JSP views and persistent file-based H2.
- Maven WAR deployed to Tomcat 9.
Not Spring Boot. Do not introduce it implicitly.
Preserve public routes, drafts, pagination, admin CRUD, CSRF protection, comment approval, original logins, and persistent data.
03 / Control points
Automate the work.
Keep the decisions explicit.
Assess
Read the findings. Establish what is obsolete, incompatible, or unknown.
Gate: confirm scope and evidence.
Plan
Review target versions, dependency order, data handling, rollback, and tests.
Gate: approve the plan before execution.
Execute
Apply the approved changes, inspect the branch history, and run regression checks.
Gate: review the PR before merging.
The agent can create branches and commits. A successful build is necessary, but is not proof of behavioral or data compatibility.
04 / Get started
One CLI. Your development platform.
Windows · PowerShell
winget install GitHub.Copilot.modernization.agentUse the documented MSI option if Winget is unavailable.
Linux / macOS · Bash or Zsh
brew tap microsoft/modernize https://github.com/microsoft/modernize-cli
brew install modernizeRequires Homebrew. Other installation options are in the official quickstart.
modernize --version
gh --version
gh auth login
Open a new terminal after installation. Requires Copilot access and GitHub CLI 2.45.0+. Install application toolchains separately; CLI portability does not make .NET Framework cross-platform.
Codespaces is optional: an alternative to local setup with CLI, .NET 10/8, JDK 27 (default) + 11, Maven, PowerShell, and Docker. No apps or assessments auto-start. A Copilot-enabled credential is still required; the legacy .NET baseline still needs Windows. Launch from the README.
05 / Prepare the experiment
One application. One branch. A known baseline.
Before asking the agent to act
- Review local changes and create a dedicated branch.
- Build and test the original application.
- Record the baseline commit and back up data.
- Use disposable data for migration experiments.
.NET application · Windows
Set-Location dotnet
# Simple
modernize assess --source . --model auto
# Full analysis
modernize assess --source . --assess-config .\modernize.yaml --model autoRun one. --source . uses the current folder; full analysis uses the included modernize.yaml.
Java application · Any supported OS
Set-Location java
# Simple
modernize assess --source . --model auto
# Full analysis
modernize assess --source . --assess-config .\modernize.yaml --model autoRun one. --source . uses the current folder; full analysis uses the included modernize.yaml.
Start one example from the repository root in PowerShell 7. Keep that terminal and application folder for the next three slides.
Without --delegate, the agent runs on your machine, not offline. --model auto picks an available model. AI analysis can use GitHub services and consume Copilot requests.
06 / Assess
Map the risks before changing the code.
Included .NET YAML
analysisCoverage: full
dotnet:
assessmentDomains: [cloud-readiness, framework-upgrade]
targetRuntime: net10.0full: issues + codebase insights. Domains: selected scans. Runtime: comparison target, not upgrade approval. Java's java/modernize.yaml contains only analysisCoverage: full.
Full analysis command
modernize assess --source . --assess-config .\modernize.yaml --model autoAn alternative to the simple command, not an extra required run. Cloud readiness assesses Azure fit; it does not deploy.
Reports: .github/modernize/assessment/. The guide explains fields, Java options, CLI flags, and CI configuration.
Get-ChildItem .\.github\modernize\assessment -Recurse -File -Filter index.html | Sort-Object LastWriteTime -Descending | Select-Object -ExpandProperty FullName
$assessmentReport = Read-Host "Paste the full path of the assessment report file"
In the same PowerShell 7 terminal, paste the full path of the report you reviewed from this run, not the output directory or an older report. The next command passes this file into planning.
07 / Plan
A target version is not a migration plan.
Choose one goal below, then run modernize plan create with the assessment report. Planning is separate from execution.
.NET: decide the migration boundary
$planName = "dotnet-blog-upgrade"
$goal = "Plan only LegacyBlog.sln: compare a Framework upgrade with supported .NET LTS / ASP.NET Core MVC. Preserve routes, data and logins. No Azure or deployment. Stop after planning for approval."Java: choose a compatible stack
$planName = "java-blog-upgrade"
$goal = "Plan only this Spring MVC app: align JDK, Spring, Security, Hibernate, H2 and Servlet/JSP container. Preserve WAR, routes, data and logins. No Spring Boot, Azure or deployment. Stop after planning for approval."modernize plan create $goal --plan-name $planName --assess-file-path $assessmentReport --model auto
Stop and inspect .github/modernize/{plan-name}/plan.md and tasks.json. Approve targets, task order, data strategy, rollback, and measurable gates before executing.
08 / Execute and validate
The strongest output is evidence.
After approval, execute in the same terminal and application folder. Inspect all branch changes, then return to the repository root and rerun regression checks.
modernize plan execute --plan-name $planName --model auto
.NET assertions
HTTP forms, publication timestamps, comment deletion, and IIS Express / LocalDB restart persistence.
Java assertions
Actual Java 11 / Tomcat 9, JSP rendering, correct 405 responses, and container-replacement persistence.
Wrapper checks
Offline checks on Windows and Linux, including explicit errors and rejection of linked assessment inputs.
Local verification snapshot: 19 October 2026. Hosted GitHub/Azure DevOps execution, paid live assessments, and native macOS execution remain unverified.
09 / Continuous validation
Two lanes. Different responsibilities.
Regression validation
.github/workflows/validate.yml
- No Copilot credential or paid assessment.
- Builds, HTTP checks, complete restarts.
- Training-fixture exclusion and docs build.
Configure branch rules to require the checks.
Modernization assessment
Manual runs, matching main pushes, or Monday 06:00 UTC schedules.
- Copilot-enabled secret required.
- Assessment reports as CI artifacts.
- No plan execution, code upgrades, or deployments.
Automatic runs require MODERNIZATION_ASSESSMENT_ENABLED=true.
pwsh -File scripts/Test-ApplicationBaseline.ps1 -App Java
Local regression example. Java requires Maven, a JDK, and Docker. For .NET on Windows, use -App DotNet; add -Restore when packages need restoring.
10 / Reusable automation
Two CI platforms.
One assessment implementation.
GitHub Actions
.github/workflows/
modernization-assessment.yml
modernization-assessment-template.ymlChoose dotnet, java, or all on manual dispatch. Download the run's assessment artifacts.
Azure DevOps
.azdo/
modernization-assessment.yml
templates/modernization-assessment.ymlSelect the YAML pipeline, provide its secret, and enable the manual run or the automatic opt-in variable.
Both call scripts/Invoke-ModernizationAssessment.ps1. Copy the shared script with the chosen templates when reusing them in another repository.
11 / Security and governance
Make the boundaries visible.
Protect assessment execution
- Use
MODERNIZE_GH_TOKEN; CI job tokens are not Copilot credentials. - Do not run credentialed assessments on PR events.
- Pin the CLI; verify release checksums.
- Reject linked inputs and stale report directories.
- Review report access and retention; public artifacts are not confidential storage.
Learn without weakening the apps
Source-only C# and Java exercises demonstrate:
They have no routes or startup registration and are excluded from the assembly and WAR.
Project-only scanners may not inspect excluded files. Select them explicitly for source-review training.
Use synthetic data only. Normal application paths retain ORM/parameterized queries, encoded output, CSRF protection, and framework password hashing.
12 / Demo sequence
Show the process, not just the prompt.
- Choose one application; build and test a disposable baseline.
- Enter its folder in PowerShell 7 and run
modernize assess --source . --model auto. - Review the report and capture its full file path.
- Run
modernize plan createwith the goal, report, and plan name from the workflow slides. - Review compatibility, data, rollback, and tests; stop for approval.
- Run
modernize plan executewith that plan name, then compare the branch and rerun regressions.
A useful planning constraint
Modernize only the selected application.
Preserve existing routes and behavior.
Keep data and original logins intact.
Do not add Azure services or deploy.
Stop after planning for my approval.Show the recorded .NET demo video, assessment, and plan when live generation is impractical. These are historical examples, not verification of the current checkout.
Then show the optional CI assessment template and separate PR regression workflow. Prepare the toolchain and a database backup before a live demo.
13 / Take it forward
Start small.
Make every change provable.
Establish a baseline, assess one app, approve a bounded plan, and let regression evidence decide when the work is ready to merge.
Apply it to this repository
- Choose the .NET or Java modernization guide; setup is an optional first step.
- Require PR validation checks through branch rules.
- Enable paid assessments only after credential and usage approval.
- Treat Azure migration as a separate, explicit decision.
Official sources
- Modernization agent overview
- Install and use the agent
- Modernize CLI commands
- Batch and non-interactive assessment
Product capabilities can evolve. Follow the current official documentation and installed CLI help.