In this lab, you will deploy a pre-built environment that you will use for the labs. The automated template will create 3 environments. Here is what is deployed:
Source environment
- 1 Windows Server 2016 VM with Visual Studio 2017 that will act as the jump box to manage the environment
- 1 Windows Server 2016 VM that will act as the domain controller for the environment
- 1 Windows Server 2008 machine that will act as the web server for the source applications
- 1 Windows Server 2008 machine with SQL 2008 installed and configured
Target environment
- 1 Azure App Service plan with 3 web applications
- 3 Azure SQL databases
- 1 Windows Server 2016 that will act as the Docker container host
- 1 Azure application gateway
- 1 Azure traffic manager
- An active Azure Subscription
- You are contributor at the subscription level
This hands-on-lab has the following exercises:
- Exercise 1: Opening Cloud Shell for the first time
- Exercise 2: Downloading the materials to the Cloud Shell environment
- Exercise 3: Deployment of Azure resources
- Exercise 4: Monitoring your deployment
- Exercise 5: Set up your Visual Studio online account
-
Open your browser and go to https://shell.azure.com
-
Sign on with
Microsoft AccountorWork or School Accountassociated with your Azure subscription -
If you have access to more than one subscription, Select the Azure directory that is associated with your Azure subscription
-
If this is the first time you accessed the Cloud Shell,
Select"PowerShell (Windows)" when asked which shell to use.Note: If this is not the first time and it is the "Bash" shell that starts, please click in the dropdown box that shows "Bash" and select "PowerShell" instead.
-
If you have at least contributor rights at subscription level, please select which subscription you would like the initialization process to create a storage account and click "Create storage" button.
-
You should see a command prompt like this one:
-
If not already open, open your browser and navigate to https://shell.azure.com. Proceed with authentication if needed.
-
The Azure Cloud Shell persists its data on a mapped folder to Azure Files service. Change directories to
C:\Users\ContainerAdministrator\CloudDrivewithcd C:\Users\ContainerAdministrator\CloudDrive
If you need to delete the directory and start over run the following:
Remove-Item .\AppMigrationWorkshop\ -Recurse -Force
-
Clone the repository from its source
git clone https://github.com/AzureCAT-GSI/AppMigrationWorkshop
In the automated deployment, we are using PowerShell Desired State Configuration (DSC) modules to help configure the virtual machines. You need to download them to the environment, so they can be deployed. The deployment script uses these modules to build the zip file that is used by the PowerShell DSC VM Extension and uploads it to the staging storage account.
-
If not already open, open your browser and navigate to https://shell.azure.com. Proceed with Authentication if needed.
-
Change the current folder to the location of cloned files
cd C:\Users\ContainerAdministrator\CloudDrive\AppMigrationWorkshop\Shared\ARM-NewIaaS\dsc -
Copy the following folders to the Cloud Shell PowerShell modules folder
copy-item cDisk -Destination C:\users\ContainerAdministrator\CloudDrive\.pscloudshell\WindowsPowerShell\Modules -Recurse -Force copy-item xActiveDirectory -Destination C:\users\ContainerAdministrator\CloudDrive\.pscloudshell\WindowsPowerShell\Modules -Recurse -Force copy-item xComputerManagement -Destination C:\users\ContainerAdministrator\CloudDrive\.pscloudshell\WindowsPowerShell\Modules -Recurse -Force copy-item xDisk -Destination C:\users\ContainerAdministrator\CloudDrive\.pscloudshell\WindowsPowerShell\Modules -Recurse -Force copy-item xNetworking -Destination C:\users\ContainerAdministrator\CloudDrive\.pscloudshell\WindowsPowerShell\Modules -Recurse -Force
-
Change directories to the location of the ARM deployment script
cd ..
-
This solution was created using Visual Studio 2017 and it provides automatically a deployment script, please execute it by replacing some of the values as follows:
.\Deploy-AzureResourceGroup.ps1 -ResourceGroupLocation <DEPLOYMENT_LOCATION> ` -ResourceGroupName <RESOURCE_GROUP_NAME> ` -UploadArtifacts ` -TemplateFile .\azuredeploy.json ` -TemplateParametersFile .\azuredeploy.parameters.json
Where:
<DEPLOYMENT_LOCATION> - Azure Location the template will for the location property of all resources <RESOURCE_GROUP_NAME> - Name of the resource group where all resources will be created
Example:
.\Deploy-AzureResourceGroup.ps1 -ResourceGroupLocation westus ` -ResourceGroupName AppModernization-RG ` -UploadArtifacts ` -TemplateFile .\azuredeploy.json ` -TemplateParametersFile ` .\azuredeploy.parameters.json
Although you can monitor your deployment from a PowerShell command prompt without any issues, CloudShell has a fixed timeout of 20 minutes, if your deployment takes more than it to complete (our case, this deployment takes approximately 35 minutes)
You will see the following message:
Since CloudShell is based on containers, when you reconnect, a new session will be presented to you and the deployment will be lost.
As mentioned before, if your deployment was executed from a PowerShell command prompt in a Virtual Machine or your own physical computer, it will not timeout and you will see the result of the deployment like this one:
The idea of this exercise is to show you how to monitor a deployment, that is independent from your deployment method (PowerShell command prompt, Azure CLI, Visual Studio, CloudShell, SDK, etc.). One method is through the Resource Group's blade's Deployment property.
-
Go to the Azure Portal (http://portal.azure.com)
-
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)
-
From the Resource Group blade, there is a left menu item list, click on
Deployments -
This will list all deployments executed and being executed, there is a column with the status of the deployment.
-
Your master deployment item is called
azuredeploy-<MMDD>-<HHMM>, this is the main item to monitor, if you want more details about it (all other deployments being shown here are created by the main deployment). Clickazuredeploy-<MMDD>-<HHMM>. -
This will show all deployments chained to the master deployment. If there is any issue or if you want to check more details you can click on
Operation DetailsorRelated Eventslink. -
You will notice that your deployment is completed after status of
azuredeploy-<MMDD>-<HHMM>deployment is Succeeded and it jumps to the top of the deployment list.
-
Open a browser and navigate to https://my.visualstudio.com
-
Sign in with your Microsoft Account or create a new one. If prompted, choose the correct account type
-
If this is the first time, wait for your account to be created.
-
From the menu, click on
Get startedfor Visual Studio Team Services -
Enter a name for your Visual Studio Online account. Choose
gitas the Repository type -
Choose Change Details and change the name of your project
-
Once your account is created, your first project will be initialized.
-
If you did not name your first project, or want to can change it, select the Gear icon from main menu
-
Find the project, click on the ellipsis and choose
Rename -
Enter
ApplicationMigrationVSOand clickOk -
You wll prompted with a warning after renaming your project. Check
I understand...and clickRename Project -
Your project is now renamed
In this hands-on lab, you learned how to:
- Use the Azure Cloud Shell
- Deploy Azure resources from an automated template
- Log on to the Azure Portal
- Use Deployment blade item of the Resource Group to monitor a deployment
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.























