Skip to content

martinpolivka/MicroHack-MigrateModernize

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

205 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Azure Migration & Modernization MicroHack

This MicroHack scenario walks through a complete migration and modernization journey using Azure Migrate and GitHub Copilot. The experience covers discovery, assessment, business case development, and application modernization for both .NET and Java workloads.

MicroHack Context

This MicroHack provides hands-on experience with the entire migration lifecycle - from initial discovery of on-premises infrastructure through to deploying modernized applications on Azure. You'll work with a simulated datacenter environment and use AI-powered tools to accelerate modernization.

Key Technologies:

  • Azure Migrate for discovery and assessment
  • GitHub Copilot for AI-powered code modernization
  • Azure App Service for hosting modernized applications

Environment creation

Install Azure PowerShell and authenticated to your Azure subscription:

Install-Module Az
Connect-AzAccount

Please note:

  • You need Administrator rights to install Azure PowerShell. If it's not an option for you, install it for the current user using Install-Module Az -Scope CurrentUser
  • It takes some time (around 10 minutes) to install. Please, complete this task in advance.
  • If you have multiple Azure subscriptions avaialble for your account, use Connect-AzAccount -TenantId YOUR-TENANT-ID to authenticate against specific one.

Once you are authenticated to Azure via PowerShell, run the following script to create the lab environment:

# Download and execute the environment creation script directly from GitHub
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/CZSK-MicroHacks/MicroHack-MigrateModernize/refs/heads/main/lab-creation/New-MicroHackEnvironment.ps1" -OutFile "$env:TEMP\New-MicroHackEnvironment.ps1"
& "$env:TEMP\New-MicroHackEnvironment.ps1"

Start your lab

Business Scenario: You're working with an organization that has on-premises infrastructure running .NET and Java applications. Your goal is to assess the environment, build a business case for migration, and modernize applications using best practices and AI assistance.

Objectives

After completing this MicroHack you will:

  • Understand how to deploy and configure Azure Migrate for infrastructure discovery
  • Know how to build compelling business cases using Azure Migrate data
  • Analyze migration readiness across servers, databases, and applications
  • Use GitHub Copilot to modernize .NET Framework applications to modern .NET
  • Leverage AI to migrate Java applications from AWS dependencies to Azure services
  • Deploy modernized applications to Azure App Service

MicroHack Challenges

General Prerequisites

This MicroHack has specific prerequisites to ensure optimal learning experience.

Required Access:

  • Azure Subscription with Contributor permissions
  • GitHub account with GitHub Copilot access

Required Software:

  • Visual Studio 2022 (for .NET modernization)
  • Visual Studio Code (for Java modernization)
  • Docker Desktop
  • Java Development Kit (JDK 8 and JDK 21)
  • Maven

Alternative: Use GitHub Codespaces (recommended if you don't have required software installed locally)

If you don't have the required software installed locally, you can use GitHub Codespaces for application modernization. Codespaces provides a cloud-based development environment with VS Code and common development tools pre-configured.

Benefits of Using Codespaces:

  • No local software installation required
  • Pre-configured development environment
  • Access from any device with a web browser
  • Consistent development environment across team members

How to Use Codespaces for Modernization:

  1. Fork the Repository: Navigate to the repository on GitHub and click the "Fork" button to create your own copy.

  2. Create a Codespace:

    • In your forked repository, click the green Code button
    • Select the Codespaces tab
    • Click Create codespace on main
    • Wait for the environment to initialize (this may take a few minutes)
  3. Install GitHub Copilot App Modernization Extension:

    Once your Codespace is running, install the GitHub Copilot App Modernization extension:

    • Open the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on macOS)
    • Search for "GitHub Copilot App Modernization"
    • Click Install
    • Restart the Codespace if prompted
    • Sign in to GitHub Copilot when prompted

    Note: You need a GitHub Copilot Pro, Pro+, Business, or Enterprise subscription to use this extension.

  4. Use GitHub Copilot for Autonomous Modernization:

    The GitHub Copilot App Modernization extension can autonomously find and modernize applications. Here's how:

    For .NET Applications (like ContosoUniversity):

    • Navigate to the ContosoUniversity project in the Explorer
    • Open the GitHub Copilot App Modernization extension from the Activity Bar
    • Use the following example prompt in the Copilot Chat:
      Find the ASP.NET application in this repository and modernize it to .NET 9.
      Upgrade the framework, migrate authentication from Windows AD to Microsoft Entra ID,
      and prepare it for Azure App Service deployment.
      
    • The agent will analyze the application, create a migration plan, and execute the modernization autonomously

    For Java Applications (like AssetManager):

    • Navigate to the AssetManager project in the Explorer
    • Open the GitHub Copilot App Modernization extension from the Activity Bar
    • Click Migrate to Azure to trigger the assessment
    • Use example prompts like:
      Assess this Java application and identify all modernization opportunities.
      Migrate from AWS S3 to Azure Blob Storage, upgrade from Java 8 to Java 21,
      and migrate from Spring Boot 2.x to 3.x autonomously.
      
    • The agent will perform the assessment and execute the guided migration tasks

    Alternative Prompt for Complete Modernization:

    Find all applications in this repository (both .NET and Java) and create a
    comprehensive modernization plan. Execute the modernization autonomously,
    including framework upgrades, cloud migration, and Azure service integration.
    
  5. Monitor the Modernization Process:

    • Watch the Copilot Chat for real-time status updates and progress
    • Review Generated Files: Check plan.md, progress.md, or dotnet-upgrade-report.md for detailed logs
    • Allow Operations: Click "Allow" when prompted for operations during the migration
    • Review Code Changes: The extension will show you the proposed changes in the editor
    • Track Validation: Monitor automated validation steps (CVE scanning, build validation, tests)
  6. Review and Apply Changes:

    • Review the Migration Plan: Before execution starts, carefully review the generated migration plan
    • Examine Code Diffs: Use the Source Control view (Ctrl+Shift+G) to see all changes
    • Test Incrementally: After each major migration step completes, review and test the changes
    • Click "Keep": When satisfied with the changes, click "Keep" to apply them
    • Resolve Issues: If validation fails, the agent will attempt to fix issues automatically
    • Commit Changes: Once all changes are validated, commit them to your branch
  7. Deploy to Azure:

    • After modernization completes successfully, the agent can help you deploy to Azure
    • Follow the deployment prompts in the Copilot Chat
    • The agent will provision necessary Azure resources and deploy your application

Important Notes:

  • The modernization process is autonomous but requires your supervision and approval
  • Always monitor the chat for questions or confirmations from the agent
  • Review all code changes before accepting them to ensure they meet your requirements
  • The agent will create a new branch for changes, allowing you to review before merging
  • Validate the application runs correctly after each major migration step
  • Keep an eye on the validation results (CVE scans, build status, test results)

Azure Resources: The lab environment provides:

  • Resource Group: on-prem
  • Hyper-V host VM with nested virtualization
  • Pre-configured virtual machines simulating datacenter workloads
  • Azure Migrate project with sample data

Estimated Time:

  • Challenge 1: 45-60 minutes
  • Challenge 2: 30-45 minutes
  • Challenge 3: 45-60 minutes
  • Challenge 4: 60-75 minutes
  • Total: 3-4 hours

Challenge 1 - Prepare a Migration Environment

Goal

Set up Azure Migrate to discover and assess your on-premises infrastructure. You'll install and configure an appliance that collects data about your servers, applications, and dependencies.

Actions

Understand Your Environment:

  1. Access the Azure Portal using the provided credentials
  2. Navigate to the on-prem resource group
  3. Connect to the Hyper-V host VM (lab@lab.LabInstance.Id-vm)
  4. Explore the nested VMs running inside the host

Hyper-V Manager showing nested VMs

  1. Verify that applications are running (e.g., http://172.100.2.110)

Application running in nested VM

Create Azure Migrate Project:

  1. Create a new Azure Migrate project in the Azure Portal
  2. Name your project (e.g., migrate-prj)
  3. Select an appropriate region (e.g., Europe)

Azure Migrate Discovery page

Deploy the Azure Migrate Appliance:

  1. Generate a project key for the appliance
  2. Download the Azure Migrate appliance VHD file

Download appliance VHD

  1. Extract the VHD inside your Hyper-V host (F: drive recommended)

Extract VHD to F drive

  1. Create a new Hyper-V VM using the extracted VHD:
    • Name: AZMAppliance
    • Generation: 1
    • RAM: 16384 MB
    • Network: NestedSwitch

Create new VM in Hyper-V

Select VHD file

  1. Start the appliance VM

Configure the Appliance:

  1. Accept license terms and set appliance password: Demo!pass123

Send Ctrl+Alt+Del to appliance

  1. Wait for Azure Migrate Appliance Configuration to load in browser

Appliance Configuration Manager

  1. Paste and verify your project key
  2. Login to Azure through the appliance interface

Login to Azure

  1. Add Hyper-V host credentials (username: adminuser, password: demo!pass123)

Add credentials

  1. Add discovery source with Hyper-V host IP: 172.100.2.1

Add discovery source

  1. Add credentials for Windows, Linux, SQL Server, and PostgreSQL workloads (password: demo!pass123)
    • Windows username: Administrator
    • Linux username: demoadmin
    • SQL username: sa

Add workload credentials

  1. Start the discovery process

Success Criteria

  • βœ… You have successfully connected to the Hyper-V host VM
  • βœ… You can access nested VMs and verify applications are running
  • βœ… Azure Migrate project has been created
  • βœ… Appliance is deployed and connected to Azure Migrate

Appliance in Azure Portal

  • βœ… All appliance services show as running in Azure Portal

Appliance services running

  • βœ… Discovery process has started collecting data from your environment

Learning Resources


Challenge 2 - Analyze Migration Data and Build a Business Case

Goal

Transform raw discovery data into actionable insights by cleaning data, grouping workloads, creating business cases, and performing technical assessments to guide migration decisions.

Actions

Review Data Quality:

  1. Navigate to already prepared (with suffix -azm) Azure Migrate project overview

Azure Migrate project overview

  1. Open the Action Center to identify data quality issues

Action Center with data issues

  1. Review common issues (powered-off VMs, connection failures, missing performance data)
  2. Understand the impact of data quality on assessment accuracy

Group Workloads into Applications:

  1. Navigate to Applications page under "Explore applications"
  2. Create a new application definition for "ContosoUniversity"
  3. Set application type as "Custom" (source code available)
  4. Link relevant workloads to the application
  5. Filter and select all ContosoUniversity-related workloads

Link workloads to application

  1. Set criticality and complexity ratings

Build a Business Case:

  1. Navigate to Business Cases section
  2. Create a new business case named "contosouniversity"
  3. Select "Selected Scope" and add ContosoUniversity application
  4. Choose target region: West US 2
  5. Configure Azure discount: 15%
  6. Build the business case and wait for calculations

Analyze an Existing Business Case:

  1. Open the pre-built "businesscase-for-paas" business case
  2. Review annual cost savings and infrastructure scope
  3. Examine current on-premises vs future Azure costs
  4. Analyze COβ‚‚ emissions reduction estimates
  5. Review migration strategy recommendations (Rehost, Replatform, Refactor)
  6. Examine Azure cost assumptions and settings

Perform Technical Assessments:

  1. Navigate to Assessments section

Assessments overview

  1. Open the "businesscase-businesscase-for-paas" assessment

Assessment details

  1. Review recommended migration paths (PaaS preferred)
  2. Analyze monthly costs by migration approach
  3. Review Web Apps to App Service assessment details
  4. Identify "Ready with conditions" applications
  5. Review ContosoUniversity application details
  6. Check server operating system support status
  7. Identify out-of-support and extended support components
  8. Review PostgreSQL database version information
  9. Examine software inventory on each server

Software inventory details

Complete Knowledge Checks:

  1. Find the count of powered-off Linux VMs

Filter powered-off Linux VMs

  1. Count Windows Server 2016 instances

Windows Server 2016 count

  1. Calculate VM costs for the ContosoUniversity application

Application costs

  1. Identify annual cost savings from the business case
  2. Determine security cost savings

Success Criteria

  • βœ… You understand data quality issues and their impact on assessments
  • βœ… Applications are properly grouped with related workloads
  • βœ… Business case successfully created showing cost analysis and ROI
  • βœ… You can navigate between business cases and technical assessments
  • βœ… Migration strategies (Rehost, Replatform, Refactor) are clearly understood
  • βœ… Application readiness status is evaluated for cloud migration
  • βœ… Out-of-support components are identified for remediation
  • βœ… You can answer specific questions about your environment using Azure Migrate data

Learning Resources


Challenge 3 - Modernize a .NET Application

Goal

Modernize the Contoso University .NET Framework application to .NET 9 and deploy it to Azure App Service using GitHub Copilot's AI-powered code transformation capabilities.

πŸ’‘ Tip: If you don't have Visual Studio 2022 installed locally, you can complete this challenge using GitHub Codespaces. See the Alternative: Use GitHub Codespaces section in the prerequisites for setup instructions.

Actions

Setup and Preparation:

  1. Navigate to https://github.com/CZSK-MicroHacks/MicroHack-MigrateModernize and click the "Fork" button in the top-right corner

Fork the repository

  1. Select your account as the owner and click "Create fork"

Create fork dialog

  1. Once the fork is created, click the "Code" button and copy your forked repository URL

Copy clone URL

  1. Open Visual Studio 2022
  2. Select "Clone a repository" and paste your forked repository URL
  3. Navigate to Solution Explorer and locate the ContosoUniversity project
  4. Rebuild the project to verify it compiles successfully

Application running in IIS Express

Assess and Upgrade to .NET 9:

  1. Right-click the ContosoUniversity project and select "Modernize"

Right-click Modernize menu

  1. Sign in to GitHub Copilot if prompted
  2. Select Claude Sonnet 4.5 as the model
  3. Click "Upgrade to a newer .NET version"
  4. Allow GitHub Copilot to analyze the codebase
  5. Review the upgrade plan when presented
  6. Allow operations when prompted during the upgrade process
  7. Wait for the upgrade to complete (marked by dotnet-upgrade-report.md appearing)

Migrate to Azure:

  1. Right-click the project again and select "Modernize"
  2. Click "Migrate to Azure" in the GitHub Copilot Chat window
  3. Wait for GitHub Copilot to assess cloud readiness

Resolve Cloud Readiness Issues: 19. Open the dotnet-upgrade-report.md file

Upgrade report with cloud readiness issues

  1. Review the Cloud Readiness Issues section
  2. Click "Migrate from Windows AD to Microsoft Entra ID"
  3. Allow GitHub Copilot to implement the authentication changes
  4. Ensure all mandatory tasks are resolved
  5. Review the changes made to authentication configuration

Deploy to Azure:

  1. Allow GitHub Copilot to complete the Azure App Service deployment
  2. Verify the deployment succeeds
  3. Test the deployed application in Azure

Success Criteria

  • βœ… ContosoUniversity solution cloned and builds successfully
  • βœ… Application upgraded from .NET Framework to .NET 9
  • βœ… Upgrade report generated showing all changes and issues
  • βœ… Authentication migrated from Windows AD to Microsoft Entra ID
  • βœ… All mandatory cloud readiness issues resolved
  • βœ… Application successfully deployed to Azure App Service
  • βœ… Deployed application is accessible and functional

Learning Resources


Challenge 4 - Modernize a Java Application

Goal

Modernize the Asset Manager Java Spring Boot application for Azure deployment, migrating from AWS dependencies to Azure services using GitHub Copilot App Modernization in VS Code.

πŸ’‘ Tip: If you don't have Docker Desktop, JDK, or Maven installed locally, you can complete this challenge using GitHub Codespaces. See the Alternative: Use GitHub Codespaces section in the prerequisites for setup instructions.

Actions

Environment Setup:

  1. Open Docker Desktop and ensure it's running 2 Open Terminal and run the setup commands:
    mkdir C:\gitrepos\lab
    cd C:\gitrepos\lab
    git clone https://github.com/CZSK-MicroHacks/MicroHack-MigrateModernize.git
    cd .\migrate-modernize-lab\src\AssetManager\
    code .
  2. Login to GitHub from VS Code
  3. Install GitHub Copilot App Modernization extension if not present

Validate Application Locally:

  1. Open Terminal in VS Code (View β†’ Terminal)
  2. Run scripts\startapp.cmd
  3. Wait for Docker containers (RabbitMQ, Postgres) to start
  4. Allow network permissions when prompted
  5. Verify application is accessible at http://localhost:8080
  6. Stop the application by closing console windows

Perform AppCAT Assessment:

  1. Open GitHub Copilot App Modernization extension in the Activity bar
  2. Ensure Claude Sonnet 4.5 is selected as the model
  3. Click "Migrate to Azure" to begin assessment
  4. Wait for AppCAT CLI installation to complete
  5. Review assessment progress in the VS Code terminal
  6. Wait for assessment results (9 cloud readiness issues, 4 Java upgrade opportunities)

Analyze Assessment Results:

  1. Review the assessment summary in GitHub Copilot chat
  2. Examine issue prioritization:
    • Mandatory (Purple) - Critical blocking issues
    • Potential (Blue) - Performance optimizations
    • Optional (Gray) - Future improvements
  3. Click on individual issues to see detailed recommendations
  4. Focus on the AWS S3 to Azure Blob Storage migration finding

Execute Guided Migration:

  1. Expand the "Migrate from AWS S3 to Azure Blob Storage" task
  2. Read the explanation of why this migration is important
  3. Click the "Run Task" button to start the migration
  4. Review the generated migration plan in the chat window and plan.md file
  5. Type "Continue" in the chat to begin code refactoring

Monitor Migration Progress:

  1. Watch the GitHub Copilot chat for real-time status updates
  2. Check the progress.md file for detailed change logs
  3. Review file modifications as they occur:
    • pom.xml and build.gradle updates for Azure SDK dependencies
    • application.properties configuration changes
    • Spring Cloud Azure version properties
  4. Allow any prompted operations during the migration

Validate Migration:

  1. Wait for automated validation to complete:
    • CVE scanning for security vulnerabilities
    • Build validation
    • Consistency checks
    • Test execution
  2. Review validation results in the chat window
  3. Allow automated fixes if validation issues are detected
  4. Confirm all validation stages pass successfully

Test Modernized Application:

  1. Open Terminal in VS Code
  2. Run scripts\startapp.cmd again
  3. Verify the application starts with Azure Blob Storage integration
  4. Test application functionality at http://localhost:8080
  5. Confirm no errors related to storage operations

Optional: Continue Modernization:

  1. Review other migration tasks in the assessment report
  2. Execute additional migrations as time permits
  3. Track progress through the plan.md and progress.md files

Success Criteria

  • βœ… Docker Desktop is running and containers are functional
  • βœ… Asset Manager application cloned and runs locally
  • βœ… AppCAT assessment completed successfully
  • βœ… Assessment identifies 9 cloud readiness issues and 4 Java upgrade opportunities
  • βœ… AWS S3 to Azure Blob Storage migration executed via guided task
  • βœ… Maven/Gradle dependencies updated with Azure SDK
  • βœ… Application configuration migrated to Azure Blob Storage
  • βœ… All validation stages pass (CVE, build, consistency, tests)
  • βœ… Modernized application runs successfully locally
  • βœ… Migration changes tracked in dedicated branch for rollback capability

Learning Resources


Finish

Congratulations! You've completed the Azure Migration & Modernization MicroHack.

What You've Accomplished:

Throughout this MicroHack, you've gained hands-on experience with the complete migration lifecycle:

Challenge 1: Migration Preparation

  • Explored a simulated datacenter environment with nested Hyper-V VMs
  • Created and configured an Azure Migrate project for discovery
  • Downloaded, installed, and configured the Azure Migrate appliance
  • Connected the appliance to on-premises infrastructure with proper credentials
  • Initiated continuous discovery for performance and dependency data collection

Challenge 2: Migration Analysis & Business Case

  • Reviewed and cleaned migration data using Azure Migrate's Action Center
  • Grouped related VMs into logical applications (ContosoUniversity)
  • Built business cases showing financial justification with cost savings and ROI analysis
  • Analyzed technical assessments for cloud readiness and migration strategies
  • Evaluated workload readiness across VMs, databases, and web applications
  • Navigated migration data to identify issues, costs, and modernization opportunities

Challenge 3: .NET Application Modernization

  • Cloned and configured the Contoso University .NET application repository
  • Used GitHub Copilot App Modernization extension in Visual Studio
  • Performed comprehensive code assessment for cloud readiness
  • Upgraded application from legacy .NET Framework to .NET 9
  • Migrated from Windows AD to Microsoft Entra ID authentication
  • Resolved cloud readiness issues identified in the upgrade report
  • Deployed the modernized application to Azure App Service

Challenge 4: Java Application Modernization

  • Set up local Java development environment with Docker and Maven
  • Ran the Asset Manager application locally to validate functionality
  • Used GitHub Copilot App Modernization extension in VS Code
  • Performed AppCAT assessment for Azure migration readiness (9 cloud readiness issues, 4 Java upgrade opportunities)
  • Executed guided migration tasks to modernize the application
  • Migrated from AWS S3 to Azure Blob Storage with automated code refactoring
  • Validated migration success through automated CVE, build, consistency, and test validation
  • Tested the modernized application locally

Skills Acquired:

  • Azure Migrate configuration and management
  • Business case development and financial analysis
  • AI-powered code modernization with GitHub Copilot
  • Migration strategy selection (Rehost, Replatform, Refactor)
  • Cloud readiness assessment and remediation
  • Azure App Service deployment
  • AppCAT assessment for Java applications
  • Automated validation and testing workflows

Key Takeaways:

This workshop demonstrated the complete migration lifecycle from discovery to deployment:

  • Assessment First: Azure Migrate provides comprehensive discovery and financial justification before migration
  • AI-Powered Modernization: GitHub Copilot dramatically accelerates code modernization while maintaining quality
  • Platform Migration: Successfully migrated dependencies (S3 to Blob Storage, Windows AD to Entra ID) alongside application code
  • Validation at Every Step: Automated testing ensures functionality is preserved throughout modernization
  • Multiple Technology Stacks: Experience with both .NET and Java modernization approaches

Next Steps & Learning Paths

Continue Your Azure Journey:

Hands-On Labs:

Continue Modernization:

  • Explore additional migration scenarios in your own environments
  • Practice with other workload types (containers, databases, etc.)
  • Experiment with GitHub Copilot for other modernization tasks
  • Continue with other migration tasks identified in the assessment reports
  • Explore containerization options for deploying to AKS or Azure Container Apps
  • Implement additional Azure services like Azure Service Bus (replacing RabbitMQ)
  • Apply Java runtime upgrades using the identified opportunities
  • Configure managed identities for passwordless authentication

If you want to give feedback, please don't hesitate to open an issue on the repository or get in touch with one of us directly.

Thank you for investing the time and see you next time!


Additional Resources

About

MicraHack Azure Migrate & app modernization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 34.2%
  • PowerShell 19.6%
  • C# 14.8%
  • HTML 10.8%
  • Java 8.4%
  • HCL 4.1%
  • Other 8.1%