Skip to content

CZSK-MicroHacks/MicroHack-MigrateModernize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

222 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 Container Apps for hosting modernized applications

Environment creation

Students: Please skip this part, the environment is already prepared for you.

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 Container Apps

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 10.
      Upgrade the framework, migrate authentication from Windows AD to Microsoft Entra ID,
      and prepare it for Azure Container Apps 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
  • Challenge 5: 45-60 minutes
  • Challenge 6: 45-60 minutes
  • Challenge 7: 60-90 minutes
  • Total: 5.25-7.5 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 onpremXXX-rg resource group
  3. Connect to the Hyper-V host VM onpremXXX-vm (login: adminuser, password: demo!pass123)
    • User RDP or Azure Bastion
  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-prjXXX)
  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: AZMApplianceXXX
    • 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 Azure Container Apps 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 10 and deploy it to Azure Container Apps 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 10:

  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 Container Apps 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 10
  • ✅ 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 Container Apps
  • ✅ 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


Challenge 5 - Deploying Applications and Data with Code

Goal

Build a repeatable Infrastructure as Code (IaC) deployment method that produces consistent results across multiple environments (dev/test/prod), reduces the risk of manual errors, and enables rapid adjustments to infrastructure and application configurations.

Actions

Use GitHub Copilot for IaC Development:

💡 Pro Tip: Use GitHub Copilot Chat to accelerate your Infrastructure as Code development throughout this challenge. Copilot can help generate Bicep/Terraform templates, deployment scripts, and configuration files.

Setup Infrastructure as Code Repository:

  1. Navigate to your forked repository in GitHub
  2. Create a new branch called iac-deployment
  3. Create a new directory structure for IaC: infrastructure/bicep or infrastructure/terraform

Define Azure Infrastructure with GitHub Copilot:

  1. Open GitHub Copilot Chat in your IDE (VS Code or Visual Studio)
  2. Use the following prompt to generate infrastructure templates:
    Generate a Bicep template for Azure Container Apps infrastructure including:
    - Log Analytics Workspace
    - Application Insights
    - Azure Container Registry
    - Container Apps Environment (depends on Log Analytics)
    - Azure SQL Database
    - Azure Storage Account
    - Container App for a .NET application
    
    Include parameters for environment name, location, and resource names.
    
  3. Review and customize the generated template for your needs
  4. Ask Copilot to explain any sections you don't understand:
    Explain the Container Apps Environment configuration and its dependencies
    

Parameterize for Multiple Environments:

  1. Create environment-specific parameter files using GitHub Copilot:
    Create parameter files for dev, test, and prod environments with appropriate SKU sizes:
    - Dev: Basic/Free tiers where possible
    - Test: Standard tiers
    - Prod: Premium tiers with high availability
    
    Include parameters for:
    - Database sizing (DTU or vCores)
    - Container Apps scaling configuration
    - Storage redundancy levels
    
  2. Review the generated parameter files and adjust values as needed
  3. Use GitHub Copilot to generate deployment scripts:
    Create a PowerShell script that deploys Bicep templates with parameter files.
    Include error handling, resource validation, and rollback capabilities.
    

Add Database Schema Deployment:

  1. Use GitHub Copilot to generate database migration scripts:
    Create SQL migration scripts for the ContosoUniversity database schema.
    Include scripts for:
    - Creating tables (Students, Courses, Enrollments)
    - Adding indexes and constraints
    - Seeding initial data
    
  2. Generate a deployment order script:
    Create a PowerShell script that runs SQL migrations in the correct order
    with transaction support and rollback capabilities.
    

Create Deployment Scripts with GitHub Copilot:

  1. Ask GitHub Copilot to create deployment automation:
    Create a comprehensive PowerShell deployment script (deploy.ps1) that:
    - Validates Azure CLI installation and authentication
    - Accepts parameters for environment (dev/test/prod), subscription, and location
    - Deploys Bicep templates with appropriate parameter files
    - Waits for deployment completion with progress feedback
    - Validates all resources were created successfully
    - Includes detailed error handling and logging
    
  2. Review and test the generated script
  3. Ask Copilot to create a cross-platform Bash version:
    Convert the deploy.ps1 script to a Bash script (deploy.sh) for Linux/macOS users
    

Implement Application Configuration Management:

  1. Use GitHub Copilot to set up configuration management:
    Show me how to configure Azure Key Vault for storing application secrets and
    how to reference these secrets in Azure Container Apps using managed identities.
    Include Bicep code for:
    - Creating Key Vault
    - Storing connection strings as secrets
    - Configuring Container App to access secrets via managed identity
    
  2. Review and implement the generated configuration code

Test IaC Deployment:

  1. Deploy to a test environment using your generated scripts:
    ./deploy.ps1 -Environment dev -Location eastus
  2. Verify all resources are created correctly
  3. Check resource tags and naming conventions
  4. Validate application connectivity to database and storage

Deploy Application Code:

  1. Use GitHub Copilot to create container deployment scripts:
    Create a script that:
    1. Builds a Docker image from the .NET application
    2. Pushes the image to Azure Container Registry
    3. Deploys the image to Azure Container Apps
    4. Runs database migrations
    5. Verifies the application is running
    
  2. Execute the deployment and verify the application starts successfully

Create Deployment Documentation:

  1. Ask GitHub Copilot to generate comprehensive documentation:
    Create a detailed README.md for the infrastructure deployment that includes:
    - Prerequisites and required tools
    - Step-by-step deployment instructions
    - Environment-specific configurations
    - Troubleshooting guide for common issues
    - Architecture diagram description
    
  2. Review and enhance the generated documentation

Success Criteria

  • ✅ Infrastructure as Code templates created (Bicep or Terraform)
  • ✅ Environment-specific parameter files for dev, test, and prod
  • ✅ All Azure resources defined as code (Container Apps, Container Registry, SQL, Storage, etc.)
  • ✅ Database schema deployment scripts created
  • ✅ Deployment automation scripts (PowerShell/Bash) functional
  • ✅ Successful deployment to at least one environment
  • ✅ Application configuration managed through Azure services (App Configuration/Key Vault)
  • ✅ Container images built and pushed to Azure Container Registry
  • ✅ Application deploys successfully to Container Apps from ACR
  • ✅ All deployments are idempotent (can be run multiple times safely)
  • ✅ Comprehensive deployment documentation created

Learning Resources


Challenge 6 - Monitoring and Operational Excellence

Goal

Establish comprehensive monitoring and observability for your applications and platform. Learn how to measure application "health", identify issues before users are impacted, evaluate the impact of changes, and quickly diagnose root causes. Configure automated alerts and set up Site Reliability Engineering (SRE) practices.

Actions

Use GitHub Copilot for Monitoring Setup:

💡 Pro Tip: GitHub Copilot can help you configure monitoring, generate KQL queries, create alert rules, and build monitoring dashboards throughout this challenge.

Enable Application Insights with GitHub Copilot:

  1. Open GitHub Copilot Chat and ask:
    How do I configure Application Insights in a .NET 10 application deployed to Azure Container Apps?
    Show me the code for appsettings.json and the necessary NuGet packages.
    
  2. Review and implement the Application Insights configuration
  3. For Java applications, ask:
    Configure Application Insights Java agent for a Spring Boot application.
    Show me the application.properties configuration.
    
  4. Deploy the updated applications with monitoring enabled

Configure Custom Telemetry with Copilot:

  1. Ask GitHub Copilot to generate custom telemetry code:
    Create custom Application Insights tracking for:
    - User registration events with user properties
    - Course enrollment actions with course and user data
    - Asset upload operations with file metadata
    
    Show me the C# code using Application Insights SDK.
    
  2. Implement the generated telemetry code in your applications
  3. For custom metrics, ask:
    Show me how to track custom metrics in Application Insights:
    - Page load times
    - API response times
    - Database query durations
    

Set Up Availability Monitoring:

  1. Configure availability tests through Azure Portal or ask Copilot:
    Create an availability test configuration for Azure Container Apps monitoring.
    Include multi-region testing and alert configuration.
    

Create Monitoring Dashboards with GitHub Copilot:

  1. Ask GitHub Copilot to generate KQL queries for your dashboards:
    Create KQL queries for Application Insights that show:
    1. Application response times (p50, p95, p99) over the last 24 hours
    2. Request rates and failure rates by endpoint
    3. Top 10 slowest requests
    4. Error rate trends with annotations
    5. Custom event tracking for business metrics (enrollments, uploads)
    
  2. Copy the generated queries and create dashboard tiles in Azure Portal
  3. Ask for more complex queries:
    Create a KQL query that correlates failed requests with their dependencies
    (database, storage) to identify root causes of failures.
    

Set Up Alerts with GitHub Copilot:

  1. Generate alert rule configurations:
    Create Azure Monitor alert rules in Bicep/Terraform for:
    - HTTP 5xx errors exceeding 5% of requests
    - Response time p95 > 2 seconds for 5 minutes
    - Application availability < 99%
    - Container App replica failures
    - Database DTU/CPU usage > 80%
    
    Include action groups with email and Teams notifications.
    
  2. Deploy the alert configurations
    • Integration with Microsoft Teams or Slack
  3. Set up smart detection for anomalies:
    • Failure rate anomalies
    • Performance degradation
    • Memory leak detection

Create Runbooks with GitHub Copilot:

  1. Ask GitHub Copilot to generate automated remediation scripts:
    Create a PowerShell runbook for Azure Automation that:
    1. Monitors Container App health status
    2. Automatically restarts the Container App if it fails health checks
    3. Scales out replicas if CPU/memory usage exceeds thresholds
    4. Sends notifications to Teams channel
    5. Logs all actions for audit trail
    
  2. Review and deploy the runbook to Azure Automation

Configure SRE Practices with Copilot:

  1. Generate SLO/SLI tracking queries:
    Create KQL queries to track Service Level Indicators:
    - Availability SLI: percentage of successful requests (non-5xx)
    - Latency SLI: p95 response time
    - Error budget calculation and burn rate
    
    Include queries for alerting when error budget is at risk.
    
  2. Create dashboards to visualize SLOs and error budgets
  3. Set up proactive alerts based on burn rate

Test Monitoring System:

  1. Use GitHub Copilot to create test scripts:
    Create a load testing script using k6 or Apache JMeter that:
    - Simulates normal user traffic
    - Gradually increases load to trigger performance alerts
    - Introduces errors to test failure detection
    - Validates alert notifications are sent
    
  2. Execute tests and verify monitoring and alerting work as expected

Success Criteria

  • ✅ Application Insights enabled and collecting telemetry
  • ✅ Custom events and metrics implemented in applications
  • ✅ Availability tests configured from multiple locations
  • ✅ Log Analytics workspace connected and collecting logs
  • ✅ Operational dashboards created showing key metrics
  • ✅ Alert rules configured for critical conditions
  • ✅ Action groups set up with appropriate notification channels
  • ✅ Distributed tracing enabled across services
  • ✅ Incident response runbooks documented
  • ✅ SLOs and SLIs defined and tracked
  • ✅ Monitoring system tested and validated through simulated failures

Learning Resources


Challenge 7 - End-to-End Deployment Automation

Goal

Create a complete end-to-end deployment pipeline that connects all previous challenges into an automated, repeatable workflow. Implement continuous integration and continuous deployment (CI/CD) practices that enable teams to release changes safely, consistently, and with confidence—from code commit to production deployment.

Actions

Use GitHub Copilot for CI/CD Pipeline Development:

💡 Pro Tip: GitHub Copilot can generate complete GitHub Actions workflows, deployment scripts, and help you implement advanced CI/CD patterns throughout this challenge.

Set Up GitHub Actions Workflow with Copilot:

  1. Navigate to your forked repository
  2. Create .github/workflows directory if it doesn't exist
  3. Open GitHub Copilot Chat and ask:
    Create a GitHub Actions workflow for deploying a .NET 10 application to Azure Container Apps.
    Include:
    - Triggers for push to main/develop branches and pull requests
    - Build and test jobs for .NET application
    - Docker image build and push to Azure Container Registry
    - Deployment to Container Apps with environment separation (dev/test/prod)
    - Manual approval gate for production
    
  4. Review and save the generated workflow as azure-deployment.yml

Implement Build Pipeline with Copilot:

  1. Ask GitHub Copilot to enhance the build pipeline:
    Add to the GitHub Actions workflow:
    - Dependency caching for faster builds
    - Code quality checks (linting with dotnet format)
    - Security scanning (Dependabot, CodeQL)
    - Code coverage reporting with threshold enforcement
    - Artifact upload for build outputs
    
  2. For Java applications, ask:
    Create a GitHub Actions job for building a Java Spring Boot application:
    - Maven build with dependency caching
    - Unit test execution with JaCoCo coverage
    - Security scanning with OWASP dependency check
    - JAR artifact creation and upload
    

Configure Infrastructure Deployment with Copilot:

  1. Ask GitHub Copilot to create infrastructure deployment jobs:
    Add a GitHub Actions job that:
    - Deploys Bicep templates from Challenge 5
    - Uses environment-specific parameter files
    - Implements environment-based deployment:
      * Dev: Auto-deploy on develop branch
      * Test: Auto-deploy on main branch  
      * Prod: Requires manual approval
    - Validates deployment using Azure CLI
    - Includes rollback on failure
    
  2. Set up GitHub Environments with protection rules
  3. Configure environment secrets for Azure credentials

Implement Database Migration Pipeline:

  1. Generate database migration automation:
    Create a GitHub Actions job for database migrations that:
    - Validates SQL script syntax
    - Checks for breaking schema changes
    - Runs migrations with Entity Framework or SQL scripts
    - Implements automatic rollback on failures
    - Logs all migration activities
    

Configure Application Deployment with Copilot:

  1. Ask GitHub Copilot to create container deployment automation:
    Create a GitHub Actions job that:
    - Builds Docker image for .NET 10 application
    - Pushes image to Azure Container Registry with version tags
    - Deploys new revision to Azure Container Apps
    - Implements blue-green deployment with traffic splitting
    - Runs smoke tests on new revision before full rollout
    - Configures environment variables from Key Vault
    - Includes automatic rollback on health check failures
    
  2. Review and implement the generated deployment workflow

Add Automated Testing with Copilot:

  1. Generate comprehensive test automation:
    Create GitHub Actions jobs for post-deployment testing:
    - Health check validation (HTTP 200 responses)
    - Integration tests for key user flows
    - Performance tests using k6 or Azure Load Testing
    - Automated rollback trigger on test failures
    - Test result reporting and notifications
    

Implement Progressive Deployment:

  1. Ask Copilot for canary deployment strategy:
    Create a GitHub Actions workflow that implements canary deployment:
    - Deploy new revision with 10% traffic split
    - Monitor Application Insights metrics for 10 minutes
    - Automatically promote to 50% if metrics are healthy
    - Gradually increase to 100% if no issues detected
    - Automatic rollback if error rate > threshold
    

Set Up Pipeline Monitoring:

  1. Generate DORA metrics tracking:
    Create a script that tracks DORA metrics from GitHub Actions:
    - Deployment frequency (commits to production per day)
    - Lead time (commit to deployment time)
    - Mean time to recovery (incident to resolution time)
    - Change failure rate (deployments causing incidents)
    
    Export metrics to Azure Monitor or create GitHub Actions dashboard.
    

Implement Security and Compliance:

  1. Use GitHub Copilot to add security scanning:
    Add to the GitHub Actions workflow:
    - CodeQL analysis for static application security testing
    - Trivy or Grype for container image vulnerability scanning
    - Dependabot alerts integration
    - Secret scanning to prevent credential leaks
    - Azure Policy compliance validation
    

Create Pipeline Documentation:

  1. Ask GitHub Copilot to generate comprehensive documentation:
    Create a complete CI/CD pipeline documentation that includes:
    - Architecture diagram in Mermaid format
    - Step-by-step workflow explanation
    - Environment configuration guide
    - Rollback procedures
    - Troubleshooting guide for common pipeline failures
    - Team responsibilities and approval processes
    

Success Criteria

  • ✅ GitHub Actions workflows created for all applications
  • ✅ Build pipelines execute successfully with tests and quality checks
  • ✅ Infrastructure deployment automated via IaC templates
  • ✅ Database migrations integrated into deployment pipeline
  • ✅ Application deployment to Azure Container Apps automated
  • ✅ Multiple environments configured (Dev, Test, Prod) with appropriate gates
  • ✅ Blue-green or canary deployment strategy implemented
  • ✅ Automated testing stages validate deployments
  • ✅ Progressive deployment with traffic splitting configured
  • ✅ Pipeline monitoring and notifications active
  • ✅ Security scanning integrated into pipeline
  • ✅ Automated and manual rollback capabilities functional
  • ✅ Complete end-to-end deployment succeeds from commit to production
  • ✅ DORA metrics tracking implemented
  • ✅ Comprehensive pipeline documentation created

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 10
  • Migrated from Windows AD to Microsoft Entra ID authentication
  • Resolved cloud readiness issues identified in the upgrade report
  • Deployed the modernized application to Azure Container Apps

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

Challenge 5: Infrastructure as Code Deployment

  • Created Infrastructure as Code templates (Bicep or Terraform)
  • Defined Azure resources as code (Container Apps, Container Registry, SQL Database, Storage Account, Application Insights)
  • Parameterized infrastructure for multiple environments (dev, test, prod)
  • Implemented database schema deployment scripts
  • Created automated deployment scripts (PowerShell and Bash)
  • Built and pushed container images to Azure Container Registry
  • Configured Azure App Configuration or Key Vault for application settings
  • Successfully deployed infrastructure and applications to Azure
  • Established repeatable, consistent deployment process

Challenge 6: Monitoring and Operational Excellence

  • Enabled Application Insights for comprehensive telemetry collection
  • Implemented custom events, metrics, and distributed tracing
  • Configured availability tests from multiple geographic locations
  • Set up Log Analytics workspace and connected logging
  • Created operational dashboards with KQL queries
  • Configured alert rules and action groups for critical conditions
  • Documented incident response runbooks
  • Defined Service Level Objectives (SLOs) and Service Level Indicators (SLIs)
  • Tested monitoring system through simulated failures
  • Established SRE practices for operational excellence

Challenge 7: End-to-End Deployment Automation

  • Created GitHub Actions workflows for CI/CD pipeline
  • Implemented build pipelines with automated testing and quality checks
  • Automated infrastructure deployment with environment-specific gates
  • Integrated database migrations into deployment pipeline
  • Configured blue-green or canary deployment strategies
  • Set up multiple environments (Dev, Test, Production) with approval workflows
  • Implemented progressive deployment with traffic splitting
  • Added security scanning and compliance checks
  • Configured automated rollback capabilities
  • Established DORA metrics tracking for continuous improvement
  • Created end-to-end automated deployment from code commit to production

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 Container Apps deployment
  • AppCAT assessment for Java applications
  • Automated validation and testing workflows
  • Infrastructure as Code (IaC) with Bicep/Terraform
  • Multi-environment deployment strategies
  • Azure monitoring and observability
  • Application Insights and Log Analytics
  • Alert configuration and incident response
  • SRE practices and SLO/SLI implementation
  • CI/CD pipeline development with GitHub Actions
  • Blue-green and canary deployment patterns
  • Automated testing and security scanning
  • DORA metrics and DevOps performance tracking

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
  • Infrastructure as Code: Repeatable, consistent deployments across environments reduce errors and enable rapid adjustments
  • Operational Excellence: Comprehensive monitoring and SRE practices ensure application health and quick incident response
  • Automation Pipeline: End-to-end CI/CD enables fast, safe, and confident releases with automated quality gates

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

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors