3365_evangelist-series-buttonThis month, my fellow IT Pro Technical Evangelists and I are authoring a new series of articles on 20 Key Scenarios with Windows Azure Infrastructure Services.  Check out the list of articles here:
http://mythoughtsonit.com/2013/05/20-key-scenarios-with-windows-azure-infrastructure-services/

 

One of the roadblocks to building a Windows 8 new interface application is that you need Windows 8 or Server 2012 to develop on. It just so happens that Microsoft has this great virtual server environment, called Windows Azure, where we can remote into a 2012 Server and build Windows 8 applications.

When creating this post I repurposed the content from my friend and colleague, Keith Mayer’s  original post, titled “Step-by-Step: Building a FREE Windows 8 App Dev Lab in the Cloud with Windows Azure Virtual Machines

In this step-by-step guide, we will cover:

  • Step 1: Provision Windows Server 2012 in a Windows Azure VM
  • Step 2: Configure Windows Server 2012 for Windows 8 App Development
  • Step 3: Install Windows 8 App Development Tools
  • Step 4: Export / Import Lab Environment On-Demand

Estimated time to complete: 45 minutes

Step 1: Provision Windows Server 2012 in a Windows Azure VM

Provision a new Windows Azure VM to run Windows Server 2012 as the basis of your Windows 8 App Development lab environment by performing the following steps:

  1. Sign in at the Windows Azure Management Portal. If you don’t have an Azure account you can get a Free Trial Account. Click this link for details on creating your 90 day trial account.
  2. Select Virtual Machines located on the side navigation panel on the Windows Azure Management Portal page.

    Virtual Machines page in Windows Azure Management Portal
  3. Click the +NEW button located on the bottom navigation bar and select Compute | Virtual Machines | From Gallery.

    Creating a New Virtual Machine From Gallery
  4. In the Virtual Machine Operating System Selection list, select Windows Server 2012, December 2012 and click the Next button.

    Virtual Machine Operating System Selection
  5. On the Virtual Machine Configuration page, complete the fields as follows:
    - New User Name: <enter a user name like xxxAdmin>
    - Virtual Machine Name: XXXwin8dev01 ( where XXX represents your initials ) 
    - New Password and Confirm Password fields: Choose and confirm a new local Administrator password. (Azure requires complex passwords)
    - Size: Medium (2 cores, 3.5GB Memory)

    Virtual Machine Configuration
    Click the Next button to continue.
  6. On the Virtual Machine Mode page, complete the fields as follows:
    - Standalone Virtual Machine: Selected
    - DNS Name: XXXwin8dev01.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 the Affinity Group defined in the Getting Started steps from the Prerequisites section above.

    Virtual Machine Mode
    Click the Next button to continue.
  7. On the Virtual Machine Options page, click the Checkmark button to begin provisioning the new virtual machine.

    Provisioning a 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.
Step 2: Configuring Windows Server 2012 for Windows 8 App Development

In this exercise, you will configure Windows Server 2012 running in a Windows Azure Virtual Machine to use Windows 8-style user interface settings so that you can use this environment for developing and testing Windows 8 Apps.

  1. After the new virtual machine has finished provisioning, click on the name ( XXXwin8dev01 ) of the new Virtual Machine displayed on the Virtual Machines page of the Windows Azure Management Portal.  This will display the Virtual Machine Details Page for XXXwin8dev01.

    Virtual Machine Details Page
  2. On the Virtual Machines Details Page for XXXwin8dev01, 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. 

    Launching a Remote Desktop Connection
  3. If prompted, in the Remote Desktop Connection Security Warning window, check the option for Don’t ask me again for connections to this computer and click the Connect button.

    Remote Desktop Connection Security Warning
  4. In the Windows Security dialog box, click the option to Use another account and enter the  username (xxxAdmin) and password used when provisioning this VM in Exercise 1 above.

    Windows Security Dialog Box
    Click the OK button to continue.
  5. If prompted, in the Remote Desktop Connection Security Warning window, check the option for Don’t ask me again for connections to this computer and click the Yes button.

    Remote Desktop Connection Security Warning
    You will be logged on to a Remote Desktop console for the newly provisioned virtual machine.  Wait for the logon process to complete and the Server Manager tool to launch before continuing with the next step.         
  6. In the Server Manager window, click on the Tools menu choice from the top navigation bar and select the Computer Management tool from the drop-down menu.

    Selecting the Computer Management Tool
  7. In the Computer Management window, expand Local Users and Groups in the left navigation pane and right-click on the Users folder located below it.  Select New User… from the pop-up menu. 

    Computer Management Window
  8. In the New User dialog box, complete the following fields to create a new Developer user account:
    - User name: Developer
    - Full name: Developer
    - Description: Developer user account for Windows 8 Apps
    - Password and Confirm Password: Choose and Confirm a new secure password.
    - User must change password at next logon: Uncheck

    New User Dialog Box
    Click the Create button and then the Close button to create a new Developer user account.
  9. In the Computer Management tool, select the Groups folder in the left navigation pane.  Right-click on the Administrators group and select Add to Group … from the pop-up menu.

    Add to Group …
  10. In the Administrators Properties dialog box, click the Add button and add the new Developer user account to this group.

    Administrators Properties Dialog Box
    Click the OK button to complete adding the new Developer user account to the local Administrators group.
    Close the Computer Management tool.
  11. In the Server Manager window, click on the Tools menu choice from the top navigation bar and select the Services tool from the drop-down menu.

    Selecting the Services Tool
  12. In the Services window, scroll down the list of services to Windows Audio
    Double-click on the  Windows Audio service and set Startup Type to Automatic.  Click OK to save this change.
    Double-click on the Windows Audio Endpoint Builder service and set Startup Type to Automatic. Click OK to save this change.
    Right-click on the Windows Audio service and select Start from the pop-up menu.  Confirm that both Windows Audio and Windows Audio Endpoint Builder services start.

    Configuring Windows Audio Services
  13. In the Server Management tool, click on the Local Server link in the left navigation pane.  
    In the Local Server Properties page click the IE Enhanced Security Configuration link located on the right side of the page. 
    In the Internet Explorer Enhanced Security Configuration dialog box, set Administrators and Users to Off.

    Internet Explorer Enhanced Security Configuration
    Click the OK button to save these changes.
    Note: Typically in a production server environment, it is recommended to keep IE Enhanced Security Configuration enabled for both Administrators and Users.  However, because this virtual machine will be an application development lab VM, we are disabling this feature to increase the usability of the lab environment.
  14. Inside the Remote Desktop session, press the WINDOWS+R key on your keyboard to pop-up the Run dialog box.  In the Open: field, type REGEDIT.EXE and click the OK button to launch the Registry Editor tool.

    Run Dialog Box
    Note: If the WINDOWS key does not pass through to the Remote Desktop session, check to make sure that your Remote Desktop Connection window is maximized.  Also, check the Local Resources tab in the options of your Remote Desktop Connection client settings to ensure that the Apply Windows key combinations setting is configured for On the remote computer.
  15. In the Registry Editor window, expand out the registry key hierarchy in the left navigation panel to navigate to the following registry location:
    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main
    In this registry location, double-click on the ApplicationTileImmersiveActivation registry value located in the right pane and set the Value data: field to 1.  Click the OK button to save this change in the registry.

    Changing A Registry Value
  16. In the Server Manager window, click on the Manage menu choice located on the top navigation bar and select Add Roles and Features from the drop-down menu.

    Manage menu in Server Manager
  17. In the Add Roles and Features Wizard window, click the Next button to accept default values on each page until you reach the Select Features page. 
    On the Select Features page, scroll down to User Interfaces and Infrastructure (Installed).  Expand this feature and select the checkbox for the Desktop Experience feature.
    When prompted, click the Add Features button and then click the Next button followed by the Install button to install the Windows 8-style Desktop Experience feature.

    Installing the Desktop Experience Feature
    After the Desktop Experience feature has been completed, you will be prompted to restart your virtual machine.

    Restart notification from Add Roles and Features Wizard
    At this point, close the Remote Desktop Connection session to the Windows Server 2012 virtual machine.
  18. On the Windows Azure Management Portal, navigate back to the Virtual Machine Details page for the XXXwin8dev01 virtual machine.

    Click on the Restart button located on the bottom toolbar to restart the virtual machine.
    After the virtual machine restarts, you may continue with the next exercise in this guide.
    Note: This restart may take a few minutes to complete, as the installation of components related to the Desktop Experience feature will be installed and configured during this restart cycle.  You can refresh your browser window to force an immediate update of the status of the virtual machine to be reflected on the Windows Azure Management Portal.
Step 3: Install Windows 8 App Development Tools

In this exercise, you will logon to the virtual machine as the Developer user account configured in Exercise 2 and install the necessary Windows 8 App Development Tools for developing, testing and publishing new Windows 8 Apps.

  1. On the Virtual Machines Details Page for XXXwin8dev01, 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. 

    Launching a Remote Desktop Connection
  2. In the Windows Security dialog box, click the option to Use another account and enter the Developer username and password configured in Exercise 2 above.     

    Windows Security Dialog Box
    You will be logged on to a Remote Desktop console for the newly provisioned virtual machine.  Wait for the logon process to complete and the Server Manager tool to launch before continuing with the next step.
  3. In the Server Manager window, click on the Manage menu choice on the top navigation bar and select Server Manager Properties from the drop-down menu.

    Server Manager Properties menu choice
  4. In the Server Manager Properties dialog box, check the checkbox option for Do not start Server Manager automatically at logon and click the OK button.

    Server Manager Properties
    Because this user account will be used for Windows 8 App development, starting Server Manager automatically at each logon will not be necessary.
    Close the Server Manager window.
  5. From within the Remote Desktop Connection session to the VM, press the WINDOWS key to navigate to the Windows 8-style Start Screen.

    Windows 8-style Start Screen
  6. On the Windows 8-style Start Screen, click the Internet Explorer tile and navigate to this step-by-step guide by browsing to http://aka.ms/W8CloudLab.
    From within the Remote Desktop Connection session, scroll back down to this step and complete the remainder of this exercise from within the virtual machine.
  7. Using Internet Explorer on the virtual machine, browse to Install Windows 8 Developer Tools

    Windows Dev Center for Windows Store Apps
  8. Under the heading Download the tools and SDK, click on the Download now button. When prompted on whether to Run, Save, or Cancel, click the Run button to launch the installation.

    Run the Installation of Developer Tools and SDK
  9. In the Visual Studio installation window, review and check the option I agree to the License Terms and conditions.  Click the INSTALL button to proceed.
  10. In the User Account Control dialog box, click the Yes button.  The installation will now continue.

    Visual Studio Installation in Progress
    The installation will take a few minutes to complete.  When completed, click on the LAUNCH button to continue with the next step in this exercise.

    Visual Studio Installation Completed
  11. In the Visual Studio registration window, click the Register online link.  A registration web page will launch.

    Visual Studio Registration Window
    Login to the registration web page with your Microsoft account (aka. Windows Live ID) and complete the registration form. 
    After submitting your registration form, copy and paste the Product Key on the registration web page into the Product Key field in the Visual Studio registration window.
    Click the Next button to continue.  If prompted with a User Account Control security dialog box, click Yes to continue.
  12. In the Visual Studio – Product Key Applied window, click the Close button.

    Visual Studio Product Key Applied
  13. After Visual Studio launches for the first time, a Developer License window will be displayed. 

    Review and click the I Agree button.  If prompted with a User Account Control security dialog box, click the Yes button to continue.
  14. In the Developer License dialog box, login with your Microsoft Account (aka. Windows Live ID) to acquire a Windows 8 App Developer License.

    Developer License Dialog Box
  15. A new developer license will be provisioned and downloaded to your installed copy of Visual Studio.  Once complete, a confirmation dialog box will be displayed.

    Developer License Confirmation Dialog Box
    Click the Close button to continue.

Your virtual machine environment is now prepared for developing, testing and submitting new Windows 8 Apps! Start Building!

Your Windows 8 App Dev lab environment is complete! Starting building your new Windows 8 App by leveraging these FREE programs and resources as your next step!

  • Your App Starts Here: Sign-up for Generation App
    Get expert guidance on a 30-day journey in developing, testing and submitting your new Windows 8 App for FREE.
(Optional) Step 4: Export / Import Lab Environment On-Demand

Our functional Windows 8 App Dev lab environment is now complete, but if you’re like me, you won’t be using this lab environment 24×7 around-the-clock.  As long as the virtual machine is provisioned, it will continue to accumulate compute hours against your Azure account regardless of virtual machine state – even in a shutdown state!

To insure we don’t waste Azure compute hours, we can leverage the Windows Azure PowerShell module to de-provision the lab virtual machine when not in use and re-provision the lab virtual machine when it is needed again.   In this section, we will walk through the steps to spin our lab environment up and down on-demand using Windows PowerShell, but if you’re using a non-Windows platform locally, you can also perform these same steps with our Windows Azure command-line tools.

Once you’ve configured the code snippets, you’ll be able to spin up your Windows 8 App Dev lab environment when needed in as little as 5-10 minutes!

Prior to beginning this exercise, please ensure that you’ve downloaded, installed and configured the Windows Azure PowerShell module.

Download, Install and Configure the Windows Azure PowerShell Management Tools

  • - Download and Install the Windows Azure PowerShell cmdlets. Note that a restart may be required after installing this module.
  • - Right-click on Windows PowerShell in your Start Menu or Start Screen and choose Run As Administrator.
  • - Set the PowerShell Execution Policy for scripts by running the following command at the PowerShell command prompt:
    PS C:\> Set-ExecutionPolicy RemoteSigned
    -
    Import the Windows Azure PowerShell module and supporting cmdlets by running the following command at the PowerShell command prompt:
    PS C:\> Import-Module Azure
    - Download and save your Windows Azure Publish Settings file by running the following command at the PowerShell command prompt:
    PS C:\> Get-AzurePublishSettingsFile
    - Import the saved Windows Azure Publish Settings file by running the following command at the PowerShell command prompt:
    PS C:\> Import-AzurePublishSettingsFile
                “full_path_to_saved_file.publishsettings”

 

Steps: De-provisioning and Re-provisioning

  1. De-provisioning your lab. Use the PowerShell snippet below to shutdown and export your lab environment when you’re not using it. 
    NOTE: Prior to running this script, be sure to edit the first line to reflect the name of your VM and confirm that the $ExportPath folder location exists.
    $myVM = “XXXwin8dev01″ 
    Stop-AzureVM -ServiceName $myVM -Name $myVM 
    $ExportPath = “C:\ExportVMs\ExportAzureVM-$myVM.xml” 
    Export-AzureVM -ServiceName $myVM -name $myVM -Path $ExportPath 
    After you’ve confirmed that the Export file exists, you can continue to de-provision your lab environment with the following PowerShell snippet:
    Remove-AzureVM -ServiceName $myVM -name $myVM
  2. Re-provisioning your lab. Use the PowerShell snippet below to import and re-provision your SharePoint lab environment when you’re ready to use it again.  Prior to running this script, be sure to edit the first two lines to reflect the names of your Virtual Network and VMs. 
    $myVM = “XXXwin8dev01″ 
    $ExportPath = “C:\ExportVMs\ExportAzureVM-$myVM.xml”    
    Import-AzureVM -Path $ExportPath | New-AzureVM -ServiceName $myVM 
    Start-AzureVM -ServiceName $myVM -name $myVM

Note:  You can also manually de-provision existing virtual machines from the Windows Azure Management Portal web page by deleting a virtual machine.  To manually re-provision a virtual machine, create a new virtual machine from the Windows Azure Management Portal web page by selecting the virtual hard disk in the gallery that was previously used by the virtual machine, rather than selecting an operating system image.