Monday, March 20, 2017

40390 - Module 4, Lab 5

Lab Answer Key:  Module 4: Virtual Machines

Lab 5: Managing Azure Storage

Exercise 1: Managing Azure Storage accounts and blobs

The main tasks for this exercise are as follows:
  1. Create a storage account.
  2. Review storage account keys.
  3. Work with Azure Storage Explorer.
  4. Copy a blob between storage accounts.

Task 1: Create a Storage Account

In this task, you will create a new storage account.
  1. Open your browser and navigate to https://portal.azure.com.
    Recommendation: Open your browser in the InPrivate mode.
  2. Enter your Microsoft Azure subscription credentials.
    If your account is associated with an organization account and a Microsoft account, you may be prompted to choose which one to authenticate with for your Microsoft Azure account.
  3. Click New, click Storage, and then click Storage Account.
  4. Specify the following storage account settings and then click Create:
  • Name: a unique name for your storage account
  • Deployment model: Resource Manager
  • Account kind: General purpose
  • Performance: Standard
  • Replication: Locally-redundant storage (LRS)
  • Storage service encryption: Disabled
  • Subscription: your Azure subscription
  • Resource Group: Ensure that the Use existing option is selected and click LABRG in the drop-down list
  • Location: Select region nearest your location.

Task 2: Review storage account keys

When you create a storage account, Azure generates two 512-bit storage access keys. These keys are used for authentication for accessing the storage account.
The storage account name in combination with storage account key function as a connection string to the storage account when accessed by third party tools, or programmatically. Azure enables regeneration of the storage account key without interruption of the storage service.
To access the storage account keys, do the following:
  1. In the hub menu of the Azure portal, click Storage accounts.
  2. On the Storage accounts blade, click the storage account you created in the previous task.
  3. On the storage account blade, click Access keys.
  4. On the Access keys page for your new storage account, note the values of key1 and key2.

Task 3: Work with Azure Storage Explorer

  1. Download and install Microsoft Azure Storage Explorer from http://storageexplorer.com/.
  2. Open Microsoft Azure Storage Explorer.
  3. When prompted to Connect to Azure Storage, ensure that Sign in using your Azure Account(s) option is selected and click Connect.
  4. When prompted, provide your credentials to connect to your subscription.
  5. To create a blob container, in the storage explorer window, click the storage account created in the earlier exercise.
  6. Right click on Blob Containers sub-node of the storage account and then select Create Blob Container, and name it newcontainer.
  7. Double-click newcontainer.
    Note: You can drag and drop files to the container
  8. On your local computer, open File Explorer and create a new folder C:\MyLocalStore.
  9. Double-click MyLocalStore to open the folder.
  10. Create a new text file named File1.txt in the MyLocalStore folder. Open the file in Notepad, type in “Hello world” in the file, save it, and close Notepad.
  11. Drag and drop the file to the newcontainer container displayed in Azure Storage Explorer.
  12. Right-click the newcontainer folder, select Set Public Access Level, and select Public read access for container and blobs, and click Apply.
  13. Right-click the newly copied file in the Azure Storage Explorer window and select Copy URL to Clipboard.
  14. Open a new InPrivate browser window and paste the URL. You should be able to see the “Hello world” text in the browser window. You can change the access level to No public access and try to reopen the file in the browser window. You will receive a message indicating that the webpage cannot be found.

Task 4: Copy a blob between storage accounts

  1. In the Azure portal create a new storage account with the same settings as the storage account you created in the first task of this lab (except for its name, which must be unique).
  2. On the Overview page of the newly created storage account, click Blobs.
  3. On the Blob service blade, click + Container.
  4. On the New container blade, specify the following and click Create
  • Name: newcontainer2
  • Access Type: Private
  1. Refresh the Microsoft Azure Storage Explorer window and navigate to the file your uploaded earlier. Right-click on the file and click Copy. Next, browse to newcontainer2 in the second storage account and click Paste on the toolbar.

40390 - Module 4, Lab 4

Lab Answer Key:  Module 4: Virtual Machines

Lab 4: Attaching Additional Storage by using the Azure portal

In this lab you will provision and configure additional storage on an Azure virtual machine using Windows Server Storage Spaces.
You must have the following to complete this lab:
  • A stable and reliable Internet connection
  • An active Microsoft Azure subscription
  • Previously completed Module 4, Lab 3
Estimated time for completion: 20 Minutes

Exercise 1: Configuring Settings on the Virtual Machine

The tasks for this exercise are as follows:
  1. Attach additional storage
  2. Create a new Storage Space for the disks
  3. Reset the lab environment (optional)

Task 1: Attach Additional Storage

In this task, you will attach two additional empty disks to the virtual machine.
  1. In the Azure portal, in the LABVM configuration blade, click Disks.
  2. Click Attach new.
  3. Accept the default properties and click OK to attach the empty disk.
  4. Repeat the same procedure to attach a second disk. In the LABVM configuration blade, click Disks.
  5. Click Attach new.
  6. Accept the default properties and click OK to attach the second empty disk.

Task 2: Create a New Storage Space for the Disks

  1. If you have not connected yet to the LABVM in the previous lab, click Overview in the LABM blade and then click the Connect button. Use the following credentials to connect to the virtual machine:
  • Login: demouser
  • Password: DemoPa$$w0rd
Once you connected, in the Remote Desktop session window, wait until Windows Server Manager opens.
  1. From within Windows Server Manager, click File and Storage Services.
  2. Click Storage Pools.
  3. Right-click the Primordial Storage Spaces entry and click New Storage Pool.
  4. In the New Storage Pool Wizard¸ specify the name of the storage pool as StoragePool1, select PhysicalDisk2 and PhysicalDisk3 to be added to the storage pool, click Create, and once the wizard completes, click Close.
  5. Right-click on the storage space, and click New Virtual Disk.
  6. For disk name, type AzureDisk, and click Next.
  7. For Storage Layout select Simple.
  8. For the Provisioning type, select Fixed.
  9. Set size to maximum.
  10. Click Create
  11. On the last page of the New Virtual Disk Wizard, ensure that the Create a volume when this wizard closes checkbox is selected and click Close.
  12. In the New Volume Wizard, accept all the default settings, but if the default drive letter is E, change it to F. Complete the wizard and click Close.
At the end of the lab you should have a new 2 TB volume spread across two disks.

Task 3: Reset the lab environment (optional)

Note: To minimize charges associated with running the lab environment, you should consider removing its resources. This is the purpose of this task.
Note: If you want to keep your lab environment in place, then you might want to consider stopping all virtual machines. This will eliminate compute charges associated with keeping these virtual machines online. To ensure that these charges do not accrue, stop the virtual machines from the Azure portal and ensure that they are listed on the Virtual machines blade with the Stopped (deallocated) state (rather than Stopped).
  1. In the Azure portal, in the hub menu, click Resource groups
  2. On the Resource groups blade, click LabRG
  3. On the LabRG blade, click Delete
  4. On the Are you sure you want to delete "LabRG? blade, type LabRG in the TYPE THE RESOURCE GROUP NAME text box, and click Delete
  5. On the Resource groups blade, click LabLinuxRG
  6. On the LabLinuxRG blade, click Delete
  7. On the Are you sure you want to delete "LabLinuxRG? blade, type LabLinuxRG in the TYPE THE RESOURCE GROUP NAME text box, and click Delete

40390 - Module 4, Lab 3

Lab Answer Key:  Module 4: Virtual Machines

Lab 3: Creating a Windows Virtual Machine

In this lab you will learn how to create a Windows virtual machine by using the Azure portal

Exercise 1: Creating an Windows virtual machine running Windows

The main tasks for this exercise are as follows:
  1. Log into the Azure portal
  2. Create a new virtual machine

Task 1: Log into the Azure portal

Launch a browser and navigate to https://portal.azure.com. Once prompted, login with your Microsoft Azure credentials. If prompted, choose whether your account is a work or school account or a Microsoft Account.
Note: You may need to launch an "in-private" session in your browser if you have multiple Microsoft Accounts.

Task 2: Create a new virtual machine

  1. Click on the + New link.
  2. Select Compute.
  3. In the Compute blade select See all.
  4. This presents the compute related gallery of resources from which you can select an image to create an instance.
  5. Use the Search feature to find an image. Begin entering Visual Studio Community 2015 in the search box.
  6. Select the image Visual Studio Community 2015 Update 3 with Azure SDK 2.9 on Windows Server 2012 R2. If this image is not available, choose the most recent one hosted on Windows Server 2012 R2.
  7. Set the deployment model to Resource Manager and click Create.
  8. Set the following configuration on the Basics blade and click OK:
  • Name: LABVM
  • VM disk type: HDD
  • User name: demouser
  • Password: DemoPa$$w0rd
  • Subscription: If you have multiple subscriptions choose the subscription used for this course.
  • Resource Group: LABRG
  • Location: Choose the closest Azure region to you
  1. Choose the D1_V2 Standard instance size on the Size blade. Note: We could use one of the recommended configurations, but if you are using a trial Azure subscription there is a restriction of 4 cores per region. Hence we are choosing a lower configuration.
  2. Accept the default values on the Settings blade and click OK to reach the Summary blade.
  3. On the Summary blade, click OK to provision the virtual machine. Note: It may take 5-10 minutes for the virtual machine to fully provision.
  4. After the virtual machine is created, the portal will automatically display its blade. Click the Connect button on the toolbar. Note: Depending on your remote desktop protocol client and browser configuration you will either be prompted to open an RDP file or you can download it and then open it to connect.
  5. Login with the credentials specified earlier in this procedure.
  • User: demouser
  • Password: DemoPa$$w0rd

40390 - Module 4, Lab 2

# Lab Answer Key:  Module 4: Virtual Machines

Lab 2: Configuring Linux Azure Virtual Machine Storage

To do this lab you'll need the following:
Lab Exercises
  1. Add virtual disks to an Azure VM
  2. Configure newly added disks in a RAID stripe set within an Azure Linux VM

Exercise 1: Add virtual disks to an Linux VM

In this exercise you will add virtual disks to an Linux VM by using the Azure portal
The main tasks for this exercise are as follows:
  1. Log in to the Azure portal
  2. Add virtual disks to an Azure

Task 1: Log in to the Azure portal

  1. Start Internet Explorer and browse to Start Internet Explorer and browse to https://portal.azure.com
  2. If prompted, sign in with your Microsoft account that is either the Service Admin or a Co-Administrator of your Azure subscription.

Task 2: Add virtual disks to an Azure

  1. In the Azure portal, browse to Virtual machines.
  2. In the list of virtual machines, click LABLinuxVM.
  3. On the LABLinuxVM blade, click Disks.
  4. On the LABLinuxVM – Disks blade, click Attach new.
  5. On the Attach new disk blade, make sure that the type of the disk is set to HDD, accept all remaining default settings, and click Location.
  6. On the Storage accounts blade, click + Storage account.
  7. On the Create storage account blade, specify the following settings and click OK:
  • Name: any unique name between 3 and 24 characters in length, consisting of a combination of lower case letters and digits
  • Performance: Standard
  • Replication: Locally-redundant storage (LRS)
  1. Back on the Storage accounts blade, click the newly created storage account.
  2. On the Containers blade, click + Container.
  3. On the New container blade, specify the following and click Create:
  • Name: vhds
  • Access type: Private
  1. Back on the Containers blade, ensure that vhds is selected and click Select.
  2. Back on the Attach new disk blade, click OK. Wait until you receive a confirmation that the disk was created. This should take less than a minute.
  3. On the LABLinuxVM – Disks blade, click Attach new.
  4. On the Attach new disk blade, make sure that the type of the disk is set to HDD, accept all remaining default settings.
  5. If the newly created storage account does not appear in the Location section, click Location and, on the Storage accounts blade, click the newly created storage account, then, on the Containers blade, click vhds and click Select.
  6. Back on the Attach new disk blade, click OK. Wait until you receive a confirmation that the disk was created. This should take less than a minute.

Exercise 2: Create a RAID stripe set within an Azure Linux VM

In this exercise you will configure newly added disks in a RAID stripe set within an Azure Linux VM.
The main tasks for this exercise are as follows: 
  1. Connect to the Azure Linux VM by using PuTTY
  2. Configure RAID stripe set within the Azure Linux VM

Task 1: Connect to the Azure Linux VM by using PuTTY

Note: If you are already connected to the Linux VM (continuing from the previous lab), skip this task.
  1. In the Azure portal, in the Overview section of the LABLinuxVM blade, note the Public IP address assigned to the VM
  2. Start putty.exe you downloaded in the previous lab.
  3. In the PuTTY Configuration window, type the IP address you noted in step 1 in the Host Name (or IP address) text box.
  4. In the Category section of the PuTTY Configuration window, expand the Connection->SSH nodes and click Auth.
  5. Click Browse next to the Private key file for authentication text box.
  6. In the Select private key file dialog box, navigate to the C:\Users_username directory (where username is your Windows user name), select myPrivateKey_rsa.ppk and click Open.
  7. If prompted by the PuTTY Security Alert, click Yes.
  8. In the PuTTY window, when prompted for the username, type Student and verify that you have successfully authenticated.

Task 2: Configure a RAID stripe set within the Azure Linux VM

  1. In the PuTTY window, run the following to elevate your privileges to root:
sudo su -
  1. Next, run the following to ensure that the latest version of the mdadm utility necessary to manage RAID configuration is available:
apt-get update
apt-get install mdadm
  1. Next, run the following to examine SCSI disk operations:
grep SCSI /var/log/syslog
  1. Examine the results and locate the entries representing the disks you added in the previous exercise. They should resemble the following:
Dec  3 11:04:33 LABLinuxVM kernel: [ 1268.731453] sd 5:0:0:0: [sdc] Attached SCSI disk
Dec  3 11:06:58 LABLinuxVM kernel: [ 1414.415135] sd 5:0:0:1: [sdd] Attached SCSI disk
  1. Create disk partitions for the first disk by running the following:
fdisk /dev/sdc 
  1. When prompted, use the following sequence of steps:
type n
type p
type 1
press <Enter>
press <Enter>
type t
type fd
type w
  1. The output should resemble the following:
root@LABLinuxVM:~# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x59132ebb.
Command (m for help): n
Partition type
 p   primary (0 primary, 0 extended, 4 free)
 e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-2145386495, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-2145386495, default 2145386495):
Created a new partition 1 of type 'Linux' and of size 1023 GiB.
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@LABLinuxVM:~#
  1. Now repeat the same sequence of steps for the second disk. Create disk partitions for the second disk by running the following:
fdisk /dev/sdd
  1. When prompted, use the following sequence of steps:
type n
type p
type 1
press <Enter>
press <Enter>
type t
type fd
type w
  1. The output should resemble the following:
root@LABLinuxVM:~# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xbbd08528.
Command (m for help): n
Partition type
 p   primary (0 primary, 0 extended, 4 free)
 e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-2145386495, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-2145386495, default 2145386495):
Created a new partition 1 of type 'Linux' and of size 1023 GiB.
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@LABLinuxVM:~#
  1. Create a RAID stripe set consisting of the two disk partitions by running the following:
mdadm --create /dev/md127 --level 0 --raid-devices 2 /dev/sdc /dev/sdd 
  1. When prompted whether to continue creating array, type y
  2. Create the file system on the new RAID stripe set by running the following:
mkfs -t ext4 /dev/md127 
  1. To add the new file system, start by creating a mount point called data. To accomplish this run the following:
mkdir /data 
  1. To mount the new RAID stripe set, you also need to identify the UUID of the file system you created. To accomplish this run the following:
/sbin/blkid 
  1. Examine the output and identify the UUID value of the /dev/md127 entry. It should resemble the following:
root@LABLinuxVM:~# /sbin/blkid
/dev/sda1: LABEL="cloudimg-rootfs" UUID="e990f8b3-1d6b-4615-8280-8ead4ed2fe7c" TYPE="ext4" PARTUUID="2865a230-01"
/dev/sdb1: LABEL="Temporary Storage" UUID="00C40FB2C40FA94C" TYPE="ntfs" PARTUUID="e08453a8-01"
/dev/sdc1: PARTUUID="59132ebb-01"
/dev/sdd1: PARTUUID="bbd08528-01"
/dev/md127: UUID="b6b3c061-06e4-48ed-86a9-cd87e0a6f59e" TYPE="ext4"
Note: The UUID value in your case will be different. Make sure to use that value in the next step.
  1. To mount the new file system, add an entry referencing this UUID to the /etc/fstab file. To accomplish this, run the following:
echo UUID=b6b3c061-06e4-48ed-86a9-cd87e0a6f59e /data ext4 defaults 0 2 >> /etc/fstab
  1. To verify that the new entry in /etc/fstab file is correct, run the following and make sure that no error messages being displayed:
mount -a
  1. To verify the outcome, run df and ensure that the output resembles the following:
root@LABLinuxVM:/data# df
Filesystem      1K-blocks    Used  Available Use% Mounted on
udev               964696       0     964696   0% /dev
tmpfs              197236    5900     191336   3% /run
/dev/sda1        29595200 1514084   28064732   6% /
tmpfs              986168       0     986168   0% /dev/shm
tmpfs                5120       0       5120   0% /run/lock
tmpfs              986168       0     986168   0% /sys/fs/cgroup
/dev/sda15         106858    3607     103251   4% /boot/efi
/dev/sdb1         4061824   16380    3819400   1% /mnt
tmpfs              197232       0     197232   0% /run/user/1000
/dev/md127     2110406720   81948 2003052172   1% /data
  1. Finally, to make the RAID array configuration persistent, run the following:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Note: After completing the lab, stop the Azure VM from the Azure portal to avoid compute charges.