Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 2 column 19
---
lab:
    title: TechLab: App Service Migration Deep Dive
    description:
    level: 300
    duration: 90 minutes
    islab: true
    primarytopics:
---

@lab.Title

Please enter your own Microsoft alias (without the @microsoft.com) in the field below before starting the lab. This information is required to correctly associate your activity with your learner record and ensure your completion is accurately captured and reported. For data integrity and compliance reasons, learners may only enter their own alias. After completing the lab, please allow up to 5 business days for all reporting systems to fully reflect your completion.

@lab.ActivityGroup(aliascapture)

===

Survey

This lab is a technical deep dive on the TechLab: App Service Migration Deep Dive. Before we begin, please take a moment to consider your experience and comfort level with this topic and answer these questions.

@lab.ActivityGroup(initialsurvey)

===

#Welcome

Welcome to the Migration and Modernization of .NET to Azure App Service Lab! In this lab, you will perform an assessment on three .NET applications, migrate one of the applications to Azure App Service and experiment with a few of the modernization features available in App Service. Please follow the steps below to get started on your journey.

Explore the applications

  1. Sign in to @lab.VirtualMachine(BuildBaseVM(Blazor)).SelectLink with Username: +++@lab.VirtualMachine(BuildBaseVM(Blazor)).Username+++ Password: +++@lab.VirtualMachine(BuildBaseVM(Blazor)).Password+++.

  2. Go to the Windows Search bar and search for +++Internet Information Services (IIS) Manager+++. Open the Internet Information Services Manager.

  3. Expand the connection on the left and then expand Sites. You will see four applications:

    • Blazor, .NET application running on Port 80
    • MvcMusicStore, .NET application running on Port 8081
    • TimeTracker, a legacy .NET application running on Port 8080
    • Default Site Name, a legacy .NET application using Windows Authentication

These applications are intended to demonstrate three scenarios:

  1. An application that is ready to be migrated to Azure App Service with no modifications
  2. An application that is ready to be migrated, but requires minor modifications to work properly on App Service
  3. An application that is not ready to be migrated and requires major modifications to be migrated to App Service

===

Exercise 1: Assessment

During this part of the lab, you'll run a PowerShell script that conducts several baseline checks on the applications running in IIS. The script will generate a json file that tells you about the migration status of each application. Additionally you'll leverage Azure Migrate application and code assessment for .NET which allows you to assess .NET source code, configurations, and binaries of your application to identify migration opportunities to Azure. It helps you identify any issues your application might have when ported to Azure and improve the performance, scalability, and security by suggesting modern, cloud-native solutions.

In this lab you will use various scripts, these can be found in C:\scripts

Task 1: Assess Applications

  1. In the Windows Search bar, enter Windows PowerShellthen right-click Windows PowerShell select "Run as Administrator". and select Yes when prompted.

  2. Change directories to the scripts folder by running cd C:\scripts.

  3. Run .\Get-SiteReadiness.ps1 to execute the application assessment script.

  4. When prompted, type R and enter. You should be prompted three times.

    You will see assessment results for the four applications:

    1. Default Site Name will indicate that it can't be migrated due to Windows Authentication
    2. TimeTracker will indicate that it could be migrated, but generates a warning about the port
    3. MvcMusicStore will indicate that it could be migrated, but generates a warning about the port
    4. Blazor will indicate that it's fully ready to be migrated and generates no warnings or checks
  5. Run code ReadinessResults.json to open the ReadinessResults.json file located in the same folder that was generated.

  6. After reviewing close IIS. Leave Powershell open for the next task.

Task 2: Analyze applications

  1. In Powershell type cd C:\apps\MvcMusicStore-Main. Run Dir to view the contents of the directory.

  2. Run appcat analyze MvcMusicStore.sln.

  3. Select Application sources.

  4. Select Azure App Service (Windows)

  5. Select Source code and settings.

  6. Choose n for Do you want to provide a config file to customize the analysis [y/n].

  7. Next, select Save as HTML for In what format should the report be generated?.

  8. Enter a name for the report.

  9. For privacy mode, select the default value. Next, choose y to continue.

  10. Once the analysis has finished select Microsoft Edge and Always.

  11. Here you can view the results. Select Aggregate Issues from the left panel.

  12. In the generated report for MvcMusicStore you can see several alerts. There are 2 windows authentication incidents with a mandatory severity level.

    [!note] The databases are not available for this exercise so MvcMusicStore cannot be migrated.

  13. You may optionally run the analysis for the BlazorApp1.sln file. To do so, in Powershell type cd C:\Users\Admin\source\repos\BlazorApp1, and follow all the previous steps in this task. You will see there are no manadatory issues for the BlazorApp1.

    Additional resources on how to Interpret Results

===

Exercise 2: Prepare the Blazor application for migration

In this step of the lab, you'll prepare the Blazor application for migration. You'll run a PowerShell script that zips up the website for the migration process.

Task 1: Analyze applications with Visual Studio

  1. In the Windows Search bar enter Windows PowerShellright-click on Windows PowerShell, select "Run as Administrator" then select Yes when prompted.

  2. Change directories to the scripts folder cd C:\scripts then enter .\Get-SitePackage.ps1 -ReadinessResultsFilePath ReadinessResults.json -SiteName Blazor -PackageResultsFileName "PackageResults.json"

    [!note] You will be prompted with a Security warning. Type R to Run Once until script successfully runs.

  3. Run Connect-AzAccount Log in using the following credentials:

  4. Prepare the migration settings for the migration script by running .\Generate-MigrationSettings.ps1 -SitePackageResultsPath packagedsites\PackageResults.json -Region eastus2 -SubscriptionId @lab.CloudSubscription.Id -ResourceGroup RG@lab.LabInstance.Id

  5. After the script has finished, open the MigrationSettings.json file by running code MigrationSettings.json. Modify the AzureSiteName to Blazor@lab.LabInstance.Id. The name here has to be globally unique for DNS resolution.

  6. Select File > Save then close Visual Studio.

Task 2: Migrate the Blazor Application

In this step of the lab, you'll migrate your Blazor application to Azure App Service using a PowerShell script. The script sizes the application and then creates an app service plan and an app service inside of an existing resource group.

  1. In the Powershell terminal type .\Invoke-SiteMigration.ps1 -MigrationSettingsFilePath "MigrationSettings.json"

  2. After the script completes, you can navigate to the Azure Portal to view your application. this may take several minutes.

    Open Microsoft Edge and navigate to +++https://portal.azure.com+++

    Close any welcome/ walkthrough dialog boxes.

[!note]When you login, navigate to Resource Groups. You'll see a resource group RG@lab.LabInstance.Id with an app service plan and an app service. The app service is now hosting your web application, but it's not yet fully functional.

===

Exercise 3: Migrate Enterprise Applications with .NET/Initiate technical assessment

In the exercise, we're using a modern ASP.NET Core app but the scripts work equally well with any ASP.NET or ASP.NET Core apps regardless of whether they run on .NET Framework or .NET Core.

Task 1: Automatic scaling

In local .NET applications hosted on IIS, you handle scaling through your Application Pools. Azure App Service offers both vertical scaling (upgrading your App Service Plan) and horizontal scaling (creating multiple instances of your app). For the purposes of this lab, we are going to focus on horizontal scaling.

Automatic scaling allows you to be prepared for unexpected spikes in traffic to your site. Let's say your Blazor site has unexpected spikes in traffic due to the hectic schedules spies have in various time zones. Enable automatic scaling by following the steps below to handle the traffic.

  1. Navigate to +++https://portal.azure.com+++ and enter the following credential if requested:

    Close any welcome/ walkthrough dialog boxes.

  2. Within the Azure Portal, Search resources for +++Blazor@lab.LabInstance.Id+++ and select your Web app.

  3. In the left menu, go to **App Service Plan ** then Scale out. 0ovs066k.jpg.

  4. Configure scaling with the following settings:

    • Scale out method: Automatic
    • Maximum burst: 3
    • Always ready instances: 1
    • Enforce scale out limit: On
    • Maximum scale limit: 3
  5. Select Save.

Task 2: Monitoring

A huge benefit of hosting your site in Azure is the ability to monitor your application and track specific metrics. Azure App Service allows you to easily enable monitoring through the portal to connect your site to Application Insights. Application Insights logs metrics and application telemetry data with features such as Live Metrics, Usage and Smart detection. Follow the steps below to enable Application Insights

  1. From within the +++Blazor@lab.LabInstance.Id+++ menu go to Monitoring

  2. Select Application Insights

  3. Next, Select the Turn on Application Insights button.

  4. Select Apply then select Yes.

  5. Once Application Insights finishes deployment, select View Application Insights data to view instance.

You've now enabled monitoring! Move onto the next step to check out the Live Metrics and other features of Application Insights in action.

Task 3: Availability Test

Application Insights Availability tests allow you to continuously monitor the responsiveness of your application. Follow the steps below to setup a basic availability test for your migrated application hosted on Azure App Service.

  1. From within your Application Insights instance

    [!note] You may access your Application Insights instance from the Resources list on the Azure portal Homepage.

  2. In the left menu under Investigate select Availability.

  3. Select Add Standard Test.

    lhp3aa7g.jpg

  4. For Test Name enter +++Basic Availability Test+++

  5. For URL enter +++https://Blazor@lab.LabInstance.Id.azurewebsites.net+++.

    [!note] The above URL can be found within the Blazor@lab.LabInstance.Id Web App within Azure Portals App Services.

    8sj9q1g0.jpg

  6. Select Create.

OPTIONAL Task: Health Check Azure App Service has a health check feature that helps increase your application's availability by rerouting requests away from unhealthy instances, and replacing instances if they remain unhealthy. Follow the below steps to configure a health check for your migrated application on App Service.
  1. Go to your App Service instance in the Azure portal.

  2. Go to the Monitoring section and then Health check

  3. Check the enable box to configure the health check.

  4. Configure the health check as /.

  5. Select Save.

Task 4: Configuring Azure Load Testing

Azure Load Testing allows you to conduct load tests on your applications and APIs with either a custom JMeter script or a script that Azure Load Testing generates for you. In this lab, you'll simulate a scaling scenario with Azure Load Test to see how App Service reacts with automatic scaling enabled.

  1. Search for +++Azure Load Testing+++ in the Azure Portal.

  2. Select Create in the upper left corner.

  3. Use the following parameters for setting up the load test:

    For everything else, leave the defaults.

  4. Select Review and create

  5. Select create

  6. Once deployed, select Go To Resource.

  7. In the Test@lab.LabInstance.Id menu select Tests.

  8. Select Create and then select Create a URL based test in the upper middle of the window.

  9. Configure the load test with the following parameters: Test Plan Tab> select +Add request, on the Add request flyout,

    URL: # +++https://Blazor@lab.LabInstance.Id.azurewebsites.net+++ , select Add

    Load Tab:

    • Engine Instances: +++4+++
    • Load pattern: Linear
    • Concurrent users per engine: +++50+++
    • Test duration: +++2+++ min
    • Ramp-up time: +++0+++ Select Review and Create then create
  10. Select Run test.

Task 5: Performance Counter Query

  1. Go to the Application Insights instance attached to your App Service.

  2. Within the left menu, select Live Metrics.

  3. Reviewing the graph for instance count shows the app auto scaled three instances to support the load.

  4. Check out the performance counters by running the following query:

    • Select logs, you will see the Queries hub panel.
    • In the top right corner of the Queries hub panel, turn OFF the blue toggle that says: Always show Queries hub,
    • Select the X in the upper-right corner of the white Queries hub panel to close it.
    • Ensure the query editor is set to KQL mode. You should now see the query editor in the tab at the top that says: New Query 1, select inside the editor area. Paste the following query . Select Run.
    requests
    | where timestamp > ago(30m) 
    | summarize count() by cloud_RoleInstance, bin(timestamp, 1m)
    | render timechart
    

    58fxih2c.jpg

===

Next Steps

Now that you know more about Azure App Service, here are a couple of projects you could use to leverage your skills and customer experience further.

Checklist for migrating web apps to Azure App Service

Checklist

App Service Landing Zone Accelerator

The App Service Landing Zone Accelerator is a reference architecture developed internally by Microsoft that demonstrates multiple scenarios using App Service including multi-tenant and App Service Environments. The architecture follows the Well-Architected Framework guidance for reliability, security, cost optimization, operational excellence, and performance efficiency. Check it out here to learn more.

Bulk App Service Assessment for Azure Virtual Machines

The App Service Migration Assistant, the PowerShell scripts you have used in this lab for assessment and migration, have been extended to support assessing 10s to 100s of .NET applications at one time. PowerShell wrapper scripts take in a list of Azure Virtual Machines with IIS hosted applications running, run pre-assessment checks, run the App Service migration assessment script on each Virtual Machine in parallel and upload the assessment results to Azure Blob Storage. To learn more about leveraging this with your customers, check out the repo here.

===

Survey

Please take a moment to answer these questions. Providing answers to these questions will complete this lab. Your answers will help us understand the effectiveness of the lab and help to improve these labs as a whole.

@lab.ActivityGroup(completionsurvey)

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors