Partager via


Step-by-Step: Building a Windows Server 2012 Storage Server in the Cloud with Windows Azure

Big data is everywhere, and the cloud is no different! Windows Server 2012 can leverage the new Storage Spaces feature and integrated iSCSI Target Server role to provide SAN-like storage capabilities when presenting storage to other servers.  When studying these features in Windows Server 2012, we can provide a functional shared storage lab environment using virtual machines in the cloud.  This article includes the detailed instructions for configuring this scenario on the Windows Azure cloud platform.

NOTE: Storage Spaces and iSCSI Storage Targets are not currently supported on the Windows Azure cloud platform for PoC, Pilot and Production workloads.  The intent of this Step-by-Step guide is to provide an easy option for evaluating and studying the configuration and management of cost-effective SAN-like storage solutions in a simulated cloud-based lab environment to prepare for later on-premise installation and also prepare for the MCSA on Windows Server 2012 certification exams.

Lab Scenario: Windows Server 2012 Storage Server in the Cloud

In this Step-by-Step guide, you will work through the process of building a Windows Server 2012 virtual machine on the Windows Azure cloud platform that leverages Storage Spaces and the iSCSI Target Server role to present a simple shared storage solution to other virtual machines in a thin-provisioned and disk fault tolerant manner.

image
Lab Scenario: Adding Windows Server 2012 Storage Server

This lab scenario will serve also serve as the basis for future Step-by-Step guides, where we will be adding Member Servers to this same Virtual Network in the Windows Azure cloud.

Prerequisites

The following is required to complete this step-by-step guide:

Complete each Knowledge Quest at your own pace based on your schedule.  You’ll receive your very own “Early Experts” Certificate of Completion, suitable for printing, framing or sharing online with your social network!

WS2012EE-Apprentice-Sample
Windows Server 2012 “Early Experts” Certificate of Completion

Let’s Get Started

In this Step-by-Step guide, you will complete the following exercises to configure a Windows Server 2012 virtual machine as a shared storage server in the cloud:

  • Deploy a New Windows Server 2012 VM in Windows Azure
  • Configure Storage Spaces on Windows Server 2012
  • Configure iSCSI Target Server Role on Windows Server 2012
  • Export / Import Lab Virtual Machines

Estimated Time to Complete: 60 minutes

Exercise 1: Deploy a New Windows Server 2012 VM in Windows Azure

In this exercise, you will provision a new Windows Azure VM to run a Windows Server 2012 on the Windows Azure Virtual Network provisioned in the prior Step-by-Step guides in the “Early Experts” Cloud Quest.

  1. Sign in at the Windows Azure Management Portal with the logon credentials used when you signed up for your Free 90-Day Windows Azure Trial.
     
  2. Select Virtual Machines located on the side navigation panel on the Windows Azure Management Portal page.
     
  3. Click the +NEW button located on the bottom navigation bar and select Compute | Virtual Machines | From Gallery.
     
  4. In the Virtual Machine Operating System Selection list, select Windows Server 2012 Datacenter and click the Next button.
     
  5. On the Virtual Machine Configuration page, complete the fields as follows:
     
    - Virtual Machine Name: XXXlabsan01
     
    - New User Name, Password and Confirm Password fields: Use the same values that you used in prior Step-by-Step Guides in the “Early Experts” Cloud Quest.
     
    - Size: Small (1 core, 1.75GB Memory)
     
    Click the Next button to continue.
     
    Note: It is suggested to use secure passwords for Administrator users and service accounts, as Windows Azure virtual machines could be accessible from the Internet knowing just their DNS.  You can also read this document on the Microsoft Security website that will help you select a secure password: https://www.microsoft.com/security/online-privacy/passwords-create.aspx.
     
  6. On the Virtual Machine Mode page, complete the fields as follows:
     
    - Standalone Virtual Machine: Selected
     
    - DNS Name: XXXlabsan01.cloudapp.net
     
    - Storage Account: Select the Storage Account defined in the Getting Started steps from the Prerequisites section above.
     
    - Region/Affinity Group/Virtual Network: Select XXXlabnet01 – the Virtual Network defined in prior Step-by-Step Guides in the “Early Experts” Cloud Quest.
     
    - Virtual Network Subnets: Select Subnet-1 (10.0.0.0/23)
     
    Click the Next button to continue.
     
  7. On the Virtual Machine Options page, click the Checkmark button to begin provisioning the new virtual machine.
     
    As the new virtual machine is being provisioned, you will see the Status column on the Virtual Machines page of the Windows Azure Management Portal cycle through several values including Stopped, Stopped (Provisioning), and Running (Provisioning) .  When provisioning for this new Virtual Machine is completed, the Status column will display a value of Running and you may continue with the next exercise in this guide.
     
  8. After the new virtual machine has finished provisioning, click on the name ( XXXlabsan01 ) of the new Virtual Machine displayed on the Virtual Machines page of the Windows Azure Management Portal to open the Virtual Machine Details Page for XXXlabsan01.

Exercise 2: Configure Storage Spaces on Windows Server 2012

In this exercise, you will add virtual storage to a Windows Server 2012 virtual machine on the Windows Azure cloud platform and configure this storage as a thin-provisioned mirrored volume using Windows Server 2012 Storage Spaces.

  1. On the Virtual Machine Details Page for XXXlabsan01, make note of the Internal IP Address displayed on this page.  This IP address should be listed as 10.0.0.6
     
    If a different internal IP address is displayed, the virtual network and/or virtual machine configuration was not completed correctly.  In this case, click the DELETE button located on the bottom toolbar of the virtual machine details page for XXXlabsan01, and go back to Exercise 1 to confirm that all steps were completed correctly. 
     
  2. On the virtual machine details page for XXXlabsan01, click the Attach button located on the bottom navigation toolbar and select Attach Empty Disk.  Complete the following fields on the Attach an empty disk to the virtual machine form:
     
    - Name: XXXlabsan01-data01
     
    - Size: 50 GB
     
    - Host Cache Preference: None
     
    Click the Checkmark button to create and attach a new virtual hard disk to virtual machine XXXlabsan01.
     
  3. Complete the task in listed above in Step 2 a second time to attach a second empty disk named XXXlabsan01-data02 to virtual machine XXXlabsan01. With the exception of a different name for this second disk, use the same values for all other fields.
     
    After completing Steps 2 & 3, your virtual machine should now be attached to two empty data disks, each of which are 50GB in size.
     
  4. On the virtual machine details page for XXXlabsan01, click the Connect button located on the bottom navigation toolbar and click the Open button to launch a Remote Desktop Connection to the console of this virtual machine. 
     
    Logon at the console of your virtual machine with the local Administrator credentials defined in Exercise 1 above. 
     
  5. Create a new Storage Pool, thin-provisioned mirrored Virtual Disk, and Volume using PowerShell.  This Volume will be used to store iSCSI SAN target LUNs in the Exercise 3.
     
    Use the PowerShell code in the following article to learn and perform this task.
     
    READ: Right-size IT Budgets with “Storage Spaces” in Windows Server 2012.

In this exercise, you completed the tasks involved in creating a new Storage Pool, thin-provisioned mirrored Virtual Disk, and Volume using PowerShell. 

Exercise 3: Configure iSCSI Target Server Role on Windows Server 2012

In this exercise, you will configure the iSCSI Target Server Role on Windows Server 2012 to be able to share block-level storage with other virtual machines in your cloud-based lab.

Begin this exercise after establishing a Remote Desktop Connection to virtual machine XXXlabsan01 and logging in as the local Administrator user account.

  1. Using the Server Manager tool, install the iSCSI Target Server Role.
     
    1. In the Server Manager window, click the Manage drop-down menu in the top navigation bar and select Add Roles and Features.
       
    2. In the Add Roles and Features Wizard dialog box, click the Next button three times to advance to the Select server roles page.
       
    3. On the Select server roles wizard page, scroll-down the Roles list and expand the File and Storage Services role category by clicking the triangle to the left.  Then, expand the File and iSCSI Services role category.
       
    4. Scroll-down the Roles list and select the checkbox for the iSCSI Target Serverrole.  Click the Next button to continue.  When prompted, click the Add Features button. 
       
    5. Click the Next button two times to advance to the Confirm installation selections wizard page.  Click the Install button to install the iSCSI Target Server role.
       
    6. When the role installation has completed, click the Close button.
       
  2. Using the Server Manager tool, create a new iSCSI Virtual Disk and iSCSI Target that can be assigned as shared storage to other virtual machines.
     
    1. In the Server Manager window, select File and Storage Services | iSCSI from the left navigation panes.
       
    2. Click on the Tasks drop-down menu and select New iSCSI Virtual Disk… to launch the New iSCSI Virtual Disk Wizard.
       
    3. On the Select iSCSI virtual disk location wizard page, select XXXlabsan01 as the server and F: as the volume on which to create a new iSCSI virtual disk. Click the Next button to continue.
       
    4. On the Specify iSCSI virtual disk name wizard page, enter iSCSIVdisk01 in the Name: field and click the Next button to continue.
       
    5. On the Specify iSCSI virtual disk size wizard page, enter 10 GB in the Size: field and click the Next button to continue.
       
    6. On the Assign iSCSI target wizard page, select New iSCSI Target and click the Next button to continue.
       
    7. On the Specify target name wizard page, enter iSCSITarget01 in the Name: field and click the Next button to continue.
       
    8. On the Specify access servers wizard page, click the Add button and add the following two servers to the Initiators list:
       
      - IP Address: 10.0.0.7
       
      - IP Address: 10.0.0.8
       
      When finished adding both servers to the Initiators list, click the Next button to continue.
       
      NOTE: In a real-world production environment, it is recommended to add iSCSI initiators to this list via DNS name or IQN.  In this Step-by-Step guide, we are entering IP Address values for each iSCSI initiator because the virtual machines for 10.0.0.7 and 10.0.0.8 have not yet been provisioned in the lab environment.
       
    9. On the Enable authentication wizard page, accept the default values and click the Next button.
       
    10. On the Confirm selections wizard page, click the Create button.
       
  3. Using the Server Manager tool, create a second new iSCSI Virtual Disk that will be assigned to the same iSCSI Target as defined above in Step 2.
     
    1. In the Server Manager window, select File and Storage Services | iSCSI from the left navigation panes.
       
    2. Click on the Tasks drop-down menu and select New iSCSI Virtual Disk… to launch the New iSCSI Virtual Disk Wizard.
       
    3. On the Select iSCSI virtual disk location wizard page, select XXXlabsan01 as the server and F: as the volume on which to create a new iSCSI virtual disk. Click the Next button to continue.
       
    4. On the Specify iSCSI virtual disk name wizard page, enter iSCSIVdisk02 in the Name: field and click the Next button to continue.
       
    5. On the Specify iSCSI virtual disk size wizard page, enter 50 GB in the Size: field and click the Next button to continue.
       
    6. On the Assign iSCSI target wizard page, select XXXiSCSITarget01 as an Existing iSCSI Target and click the Next button to continue.
       
    7. On the Confirm selections wizard page, click the Create button.

In this exercise, you have installed the iSCSI Target Server role on Windows Server 2012 and configured two iSCSI virtual disks that can presented as shared storage to other virtual machines via a common iSCSI Target definition.

The above tasks can also be performed via PowerShell by leveraging the iSCSI PowerShell module cmdlets as follows:

# Define New iSCSI Target and assign it to two iSCSI initiators

New-IscsiServerTarget –TargetName “iSCSITarget01” –InitiatorID “IPAddress:10.0.0.7,IPAddress:10.0.0.8”

# Create Two New iSCSI Virtual Disks

New-IscsiVirtualDisk –Path “F:\iSCSIVirtualDisks\iSCSIVdisk01.vhd” –Size 10GB

New-IscsiVirtualDisk –Path “F:\iSCSIVirtualDisks\iSCSIVdisk02.vhd” –Size 50GB

# Associate the iSCSI Virtual Disks with the iSCSI Target

Add-IscsiVirtualDiskTargetMapping –TargetName “iSCSITarget01” –DevicePath “F:\iSCSIVirtualDisks\iSCSIVdisk01.vhd”

Add-IscsiVirtualDiskTargetMapping –TargetName “iSCSITarget01” –DevicePath “F:\iSCSIVirtualDisks\iSCSIVdisk02.vhd”

Exercise 4: Export / Import Lab Virtual Machines

Our Windows Server 2012 cloud-based lab is now functional, but if you’re like me, you may not be using this lab VM 24x7 around-the-clock.  As long as a virtual machine is provisioned, it will continue to accumulate compute hours against your Free 90-Day Windows Azure Trial account regardless of virtual machine state – even in a shutdown state!

To save our compute hours for productive study time, we can leverage the Windows Azure PowerShell module to automate export and import tasks to de-provision our virtual machines when not in use and re-provision our virtual machines when needed again.

In this exercise, we’ll step through using Windows PowerShell to automate:

  • De-provisioning lab virtual machines when not in use
  • Re-provisioning lab virtual machines when needed again.

Once you’ve configured the PowerShell snippets below, you’ll be able to spin up your cloud-based lab environment when needed in just a few minutes!

Note: Prior to beginning this exercise, please ensure that you’ve downloaded, installed and configured the Windows Azure PowerShell module as outlined in the Getting Started article listed in the Prerequisite section of this step-by-step guide.  For a step-by-step walkthrough of configuring PowerShell support for Azure, see Setting Up Management by Brian Lewis, one of my peer IT Pro Technical Evangelists.

  1. De-provision the lab. Use the Stop-AzureVM and Export-AzureVM cmdlets in the PowerShell snippet below to shutdown and export lab VMs when they are not being used.  
      
    NOTE: Prior to running this snippet, be sure to edit the first line to reflect the name of your VM and confirm that the $ExportPath folder location exists.

    $myVM = “XXXlabsan01”
    $myCloudSvc = "XXXlabsan01"

    Stop-AzureVM -ServiceName $myCloudSvc -Name $myVM

    $ExportPath = "C:\ExportVMs\ExportAzureVM-$myVM.xml"
    Export-AzureVM -ServiceName $myCloudSvc -name $myVM -Path $ExportPath
     
     
    After you've verified that all Export files were created in the folder location specified by $ExportPath, you can then de-provision your VM with the following PowerShell snippet: 
     
    Remove-AzureVM -ServiceName $myCloudSvc -name $myVM
     

  2. Re-provision the lab. Use the Import-AzureVM and Start-AzureVM cmdlets in the PowerShell snippet below to import and start lab VMs when needed again.
          
    $myVNet = "XXXlabnet01"
    $myVM = "XXXlabsan01"
    $myCloudSvc = "XXXlabsan01"
    $myStorageAccount = "XXXlabstor01"

    Get-AzureSubscription | Set-AzureSubscription -CurrentStorageAccount $myStorageAccount

    $ExportPath = "C:\ExportVMs\ExportAzureVM-$myVM.xml"
    Import-AzureVM -Path $ExportPath | New-AzureVM -ServiceName $myCloudSvc -VNetName $myVNet

    Start-AzureVM -ServiceName $myCloudSvc -name $myVM

Completed! What’s Next?

The installation and configuration of a new Windows Server 2012 Storage Server running on Windows Azure is now complete.  To continue your learning about Windows Server 2012, explore these other great resources:

  • Join the Windows Server 2012 “Early Experts” Challenge study group to learn more about Windows Server 2012! and prepare for MCSA Certification!
     
  • Learn more about Windows Azure Virtual Machines and Virtual Networks with this FREE Online Training!
     
  • Complete the other Hands-On Labs in the "Early Experts" Cloud Quest to request your certificate of completion ... Become our next "Early Expert"!

How are you using Windows Azure Virtual Machines and Virtual Networks?

Do you have an interesting or unique scenario that you are evaluating on the Windows Azure cloud platform?  Feel free to leave your comments, feedback and ideas below to share across our IT Pro community!

Comments