Skip to content

Latest commit

 

History

History
253 lines (151 loc) · 10.5 KB

File metadata and controls

253 lines (151 loc) · 10.5 KB

Setting up the source environment using Resource Manager Templates

Overview

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

Prerequisites

  • An active Azure Subscription
  • You are contributor at the subscription level

Exercises

This hands-on-lab has the following exercises:

  1. Exercise 1: Opening Cloud Shell for the first time
  2. Exercise 2: Downloading the materials to the Cloud Shell environment
  3. Exercise 3: Deployment of Azure resources
  4. Exercise 4: Monitoring your deployment
  5. Exercise 5: Set up your Visual Studio online account

Exercise 1: Opening Cloud Shell for the first time


  1. Open your browser and go to https://shell.azure.com

  2. Sign on with Microsoft Account or Work or School Account associated with your Azure subscription

    image

    image

  3. If you have access to more than one subscription, Select the Azure directory that is associated with your Azure subscription

  4. If this is the first time you accessed the Cloud Shell, Select "PowerShell (Windows)" when asked which shell to use.

    image

    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.

  5. 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.

    image

  6. You should see a command prompt like this one:

    image

Exercise 2: Downloading artifacts to the Cloud Shell environment


  1. If not already open, open your browser and navigate to https://shell.azure.com. Proceed with authentication if needed.

  2. The Azure Cloud Shell persists its data on a mapped folder to Azure Files service. Change directories to C:\Users\ContainerAdministrator\CloudDrive with

    cd C:\Users\ContainerAdministrator\CloudDrive

    If you need to delete the directory and start over run the following:

    Remove-Item .\AppMigrationWorkshop\ -Recurse -Force
  3. Clone the repository from its source

    git clone https://github.com/AzureCAT-GSI/AppMigrationWorkshop

Exercise 3: Deployment of Azure resources


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.

  1. If not already open, open your browser and navigate to https://shell.azure.com. Proceed with Authentication if needed.

  2. Change the current folder to the location of cloned files

    cd C:\Users\ContainerAdministrator\CloudDrive\AppMigrationWorkshop\Shared\ARM-NewIaaS\dsc
  3. 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
  4. Change directories to the location of the ARM deployment script

    cd ..
  5. 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

Exercise 4: Monitoring your deployment


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:

image

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:

image

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.

  1. Go to the Azure Portal (http://portal.azure.com)

  2. In the portal, in the left navigation pane, click Resource Groups

    image

  3. From the Resource Group list, select the one deployed in HOL 1 (e.g. AppModernization-RG)

    image

  4. From the Resource Group blade, there is a left menu item list, click on Deployments

    image

  5. This will list all deployments executed and being executed, there is a column with the status of the deployment.

    image

  6. 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). Click azuredeploy-<MMDD>-<HHMM>.

    image

  7. 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 Details or Related Events link.

    image

  8. 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.

    image

Exercise 5: Set up your Visual Studio Online Account


  1. Open a browser and navigate to https://my.visualstudio.com

  2. Sign in with your Microsoft Account or create a new one. If prompted, choose the correct account type

    image

  3. If this is the first time, wait for your account to be created.

    image

  4. From the menu, click on Get started for Visual Studio Team Services

    image

  5. Enter a name for your Visual Studio Online account. Choose git as the Repository type

    image

  6. Choose Change Details and change the name of your project

    image

  7. Once your account is created, your first project will be initialized.

  8. If you did not name your first project, or want to can change it, select the Gear icon from main menu

    image

  9. Find the project, click on the ellipsis and choose Rename

    image

  10. Enter ApplicationMigrationVSO and click Ok

    image

  11. You wll prompted with a warning after renaming your project. Check I understand... and click Rename Project

    image

  12. Your project is now renamed

    image

Summary

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.