In this lab, you will install three sample legacy applications. The sample legacy applications will be used as the source for migrating to Azure.
Applications
- Timetracker
- Classifieds
- Jobs
- An active Azure Subscription
- You have the working source environment deployed on Lab 01
This hands-on-lab has the following exercises:
- Exercise 1: Configuration Steps on Jumpbox VM
- Exercise 2: Configuration Steps on SQL Server
- Exercise 3: Configuration Steps on Web Server
- Exercise 4: Test the web applications
These configuration steps will be performed from the Jumpbox.
-
Go to the Azure Portal (http://portal.azure.com)
-
Sign on with
Microsoft AccountorWork or School Accountassociated with your Azure subscription -
In the portal, in the left navigation pane, click
Resource Groups -
From the Resource Group list, select the one deployed in HOL 1 (e.g. AppModernization-RG)
-
Locate the
JumpboxVirtual Machine by searching forjmpin the resource name field. The Jumpbox will be suffixed with -jmp (i.e. apmqy63-jmp) -
Click on the JumpBox VM and click
Connect -
When prompted to Save or Open, choose
Open -
When prompted to connect to remote session, choose
Connect -
When Prompted, choose
More Choices > Use a Different Account -
Enter the administrator credentials as follows:
User name: appmig\appmigadmin
Password: @pp_M!gr@ti0n-2018
-
When prompted to accept the certificate, choose
Yes -
Open Server Manager and disable the Internet Explorer Enhanced Security Configuration
-
Choose
Offfor Administrators and clickOk
-
Open a PowerShell session
-
Install Active Directory and DNS remote administration tools
Add-WindowsFeature -Name RSAT-AD-PowerShell Add-WindowsFeature -Name RSAT-DNS-Server
-
Create the service account that will be assigned to the application pools later
New-ADUser -SamAccountName AppsSvcAcct -Name "AppsSvcAcct" -UserPrincipalName AppsSvcAcct@appmig.local -AccountPassword (ConvertTo-SecureString -AsPlainText "@pp_M!gr@ti0n-2018" -Force) -Enabled $true -PasswordNeverExpires $true
-
Create DNS entries (A record) for each web site
$dc = Get-ADDomainController Add-DnsServerPrimaryZone -NetworkID "10.0.0.0/16" -ReplicationScope "Forest" -ResponsiblePerson "appmigadmin@appmig.local" -DynamicUpdate Secure -ComputerName $dc.hostname -Verbose -ErrorAction SilentlyContinue $webSrv = Get-DnsServerResourceRecord -ComputerName $dc.hostname -ZoneName $dc.domain | Where-Object {$_.hostname -like "*-web"} Add-DnsServerResourceRecordA -Name timetracker -IPv4Address $webSrv.RecordData.IPv4Address.IPAddressToString -ZoneName $dc.Domain -CreatePtr -ComputerName $dc.HostName Add-DnsServerResourceRecordA -Name classifieds -IPv4Address $webSrv.RecordData.IPv4Address.IPAddressToString -ZoneName $dc.Domain -CreatePtr -ComputerName $dc.HostName Add-DnsServerResourceRecordA -Name jobs -IPv4Address $webSrv.RecordData.IPv4Address.IPAddressToString -ZoneName $dc.Domain -CreatePtr -ComputerName $dc.HostName
-
If not already in a session, open a
PowerShell window -
Clone the GitHub repository to the root
cd\ git clone https://github.com/AzureCAT-GSI/AppMigrationWorkshop.git
-
Extract each application
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') Get-ChildItem "C:\AppMigrationWorkshop\Shared\SourceApps\Apps\" -Exclude "petshop" | ` % { $dest = Join-Path $_.directoryname ([system.io.path]::GetFileNameWithoutExtension($_.name)); ` mkdir $dest -force; [System.IO.Compression.ZipFile]::ExtractToDirectory($_.fullname, $dest)}
-
Copying the database backup files to the SQL server
copy-item "C:\AppMigrationWorkshop\Shared\SourceApps\Databases\" -Destination \\10.0.1.100\c$ -Recurse
-
Copying the application source files to the IIS server
copy-item "C:\AppMigrationWorkshop\Shared\SourceApps\Apps\" -Destination \\10.0.0.4\c$ -Recurse
These configuration steps will be performed from the SQL server. You can access this machine from the JumpBox as the servers are not publicly accessible.
-
In the Azure Portal, locate the machine name of the SQL server. The machine will suffixed with
-sql. Copy the machine name to the clipboard. -
From the JumpBox, start a remote desktop connection to the
SQL Servermachine -
Enter the SQL server VM (paste from the previous copy since the names will all be different in each deployment) name and click
Connect. Enter the Administrator credentials and clickOkNote: User name here MUST have the domain name, otherwise these steps will fail. E.g.
APPMIG\appmigadmin -
Once on the SQL server, open a PowerShell session and Issue the following commands to restore the databases
SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "RESTORE DATABASE [TimeTracker] FROM DISK='C:\Databases\timetracker.bak' WITH MOVE 'tempname' TO 'C:\Databases\timetracker.mdf', MOVE 'TimeTracker_Log' TO 'C:\Databases\timetracker_log.ldf'" SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "RESTORE DATABASE [Classifieds] FROM DISK='C:\Databases\classifieds.bak' WITH MOVE 'Database' TO 'C:\Databases\classifieds.mdf', MOVE 'Database_log' TO 'C:\Databases\classifieds_log.ldf'" SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "RESTORE DATABASE [Jobs] FROM DISK='C:\Databases\jobs.bak' WITH MOVE 'EmptyDatabase' TO 'C:\Databases\jobs.mdf', MOVE 'EmptyDatabase_log' TO 'C:\Databases\jobs_log.ldf'"
-
Creating the SQL logins
SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "CREATE LOGIN [APPMIG\AppsSvcAcct] FROM WINDOWS"
-
Create users in the database
SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "USE timetracker; CREATE USER [APPMIG\AppsSvcAcct];" SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "USE classifieds; CREATE USER [APPMIG\AppsSvcAcct];" SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "USE jobs; CREATE USER [APPMIG\AppsSvcAcct];"
-
Configure the user as db_owner
SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "USE timetracker; EXEC sp_addrolemember 'db_owner', 'APPMIG\AppsSvcAcct'" SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "USE classifieds; EXEC sp_addrolemember 'db_owner', 'APPMIG\AppsSvcAcct'" SQLCMD -E -S $($ENV:COMPUTERNAME) -Q "USE jobs; EXEC sp_addrolemember 'db_owner', 'APPMIG\AppsSvcAcct'"
These configuration steps will be performed from the Web server. You can access this machine from the JumpBox as the servers are not publicly accessible.
-
In the Azure Portal, locate the machine name of the Web server. The machine will suffixed with
-web. Copy the machine name to the clipboard. -
From the JumpBox, start a remote desktop connection to the
Web Servermachine -
Enter the Web server VM name and click
Connect. Enter the Administrator credentials and clickOk. Please notice that this is the same case of all other VMs, you must precede the username with the domain name APPMIG. -
Once on the Web Server, open a PowerShell session
-
Issue the following commands to configure the IIS Application Pools
c:\windows\system32\inetsrv\appcmd.exe add apppool /name:"TimeTrackerAppPool" /managedPipelineMode:"Integrated" c:\windows\system32\inetsrv\appcmd.exe add apppool /name:"ClassifiedsAppPool" /managedPipelineMode:"Classic" c:\windows\system32\inetsrv\appcmd.exe add apppool /name:"JobsAppPool" /managedPipelineMode:"Integrated"
-
Grant the necessary permissions for the service account
c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -ga appmig\AppsSvcAcct
-
Configure Application Pools to use the service account
c:\windows\system32\inetsrv\appcmd set config /section:applicationPools "/[name='TimeTrackerAppPool'].processModel.identityType:SpecificUser" "/[name='TimeTrackerAppPool'].processModel.userName:appmig\AppsSvcAcct" "/[name='TimeTrackerAppPool'].processModel.password:@pp_M!gr@ti0n-2018" c:\windows\system32\inetsrv\appcmd set config /section:applicationPools "/[name='ClassifiedsAppPool'].processModel.identityType:SpecificUser" "/[name='ClassifiedsAppPool'].processModel.userName:appmig\AppsSvcAcct" "/[name='ClassifiedsAppPool'].processModel.password:@pp_M!gr@ti0n-2018" c:\windows\system32\inetsrv\appcmd set config /section:applicationPools "/[name='JobsAppPool'].processModel.identityType:SpecificUser" "/[name='JobsAppPool'].processModel.userName:appmig\AppsSvcAcct" "/[name='JobsAppPool'].processModel.password:@pp_M!gr@ti0n-2018"
-
Delete the default web site to avoid conflicts
c:\windows\system32\inetsrv\appcmd delete site "Default Web Site" -
Create the IIS web sites
c:\windows\system32\inetsrv\APPCMD add site /name:TimeTracker /id:1 /bindings:http://timetracker:80 /physicalPath:C:\Apps\TimeTracker c:\windows\system32\inetsrv\APPCMD set site TimeTracker "/[path='/'].applicationPool:TimeTrackerAppPool" c:\windows\system32\inetsrv\APPCMD add site /name:Classifieds /id:2 /bindings:http://classifieds:80 /physicalPath:C:\Apps\Classifieds c:\windows\system32\inetsrv\APPCMD set site Classifieds "/[path='/'].applicationPool:ClassifiedsAppPool" c:\windows\system32\inetsrv\APPCMD add site /name:Jobs /id:3 /bindings:http://jobs:80 /physicalPath:C:\Apps\Jobs c:\windows\system32\inetsrv\APPCMD set site Jobs "/[path='/'].applicationPool:JobsAppPool"
-
On the file system, update the web.config files for each source apps to connect to the database. The files are in the
C:\Appsfolder. Replace all occurrences of<sqlServerName>with your SQL Server VM name- C:\Apps\Jobs\Web.Config
- C:\Apps\Classifieds\Web.Config
- c:\Apps\TimeTracker\Web.Config
This configuration is performed from the Jump Box
-
Disable the IE Enhanced Security Configuration to allow local browsing from the web server. Click
Server Manager -
Locate the Security Information section and click
Configure IE ESC -
Under Administrators, select
OffthenOk -
Open the browser and navigate to the following URLs to ensure the sites are functioning:
In this hands-on lab, you learned how to:
- Configure the legacy applications
Copyright 2016 Microsoft Corporation. All rights reserved. Except where otherwise noted, these materials are licensed under the terms of the MIT License. You may use them according to the license as is most appropriate for your project. The terms of this license can be found at https://opensource.org/licenses/MIT.





















