Learning System Center App Controller (2015)
Chapter 5. Exploring Advanced Options
In this chapter, we will explore the advanced functionality provided by System Center 2012 R2 App Controller. App Controller gives us the single pane of glass console to administrate the on-premises private cloud and public cloud. We can migrate virtual machines from the on-premises private cloud to the Azure cloud. App Controller also provides a functionality to view operating system images and service templates available in the Azure cloud.
In this chapter, we will cover the following topics:
· Copying VHD files from a private cloud to the Azure cloud
· App Controller PowerShell module installation
· Introduction to App Controller PowerShell cmdlets
In previous chapters, we installed App Controller. For help with App Controller installation, refer to Chapter 2, Installing and Working with Different App Controller Components.
Copying VHD files from a private cloud to Microsoft Azure
In this section, we will be copying a virtual machine VHD file to the Azure cloud. Then, we can use the uploaded VHD file during deployment of a virtual machine. We must configure a storage location to upload the VHD file in the Azure cloud. Before we can upload the VHD file, some limitations need to be kept in mind during the preparation of the file, which are as follows:
· At the time of writing this, the Azure cloud supports the following Windows operating systems: Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2.
· At the time of writing this, the newer VHDX format is not supported in Azure. We can, however, convert VHDX to the VHD format using Hyper-V manager. We can also use the convert-vhd PowerShell integrated cmdlet. If you get an error message for convert-vhd cmdlet not found, then add Remote Server Administration Tools and Hyper-V Module for Windows PowerShell in the server manager. The Hyper-V role is also required for successful conversion.
· Remote desktop must be enabled on the virtual machine.
· Do not Sysprep the virtual machine, instead simply shutdown the virtual machine. If you are preparing to upload VHD with a custom image to the Azure gallery, then Sysprep is required.
· A local administrative user account and password must be set on the virtual machine.
To complete the tasks mentioned in the previous points, perform the following steps:
1. VHD upload steps will be performed mostly in the App Controller console.
2. Now, we will create a location in the Azure cloud to store our VHD file. Log on to the App Controller console and select Library from the left pane. Now, select the Windows Azure section in the middle pane and expand Azure Demo Environment. Ensure that Azure Demo Environment is selected and click on Create Storage Account in the top menu, as shown in the following screenshot:
3. Provide a unique name and region in the settings. Click on the OK button. I have provided azurestoragedemoacc01 as the name. In the next couple of minutes, a new storage account will show up in the App Controller console.
4. Select the new azurestoragedemoacc01 storage account and click on the Create Container button in the top menu. Name it vhds and click on the OK button.
5. We can also use the Windows PowerShell module for App Controller to perform these tasks. Use Import-module AppController and get command-module AppController to see all 29 cmdlets available for App Controller.
6. Use the following script in PowerShell ISE to connect to the App Controller server:
7. In the App Controller console, click on the Library link in the left pane. From the middle pane, expand the private cloud created in the VMM server by clicking on the triangle to the left of the name. Select the on-premises private cloud library MSSCVMMLibrary. A list of available content in the library will be displayed in the right pane. Right-click on the required VHD file in the right pane and select Copy. Then browse to SCAC_Share, created earlier in the Adding a network share section in Chapter 4, Customizing App Controller. Right-click on an empty area in the right pane and select Paste. Take a look at the following screenshot:
8. Select the \SCAC_Share file that we created earlier from the middle pane. Right-click on the right pane and select Paste. For instructions on creating a share, refer to the Adding a network share section in Chapter 4, Customizing App Controller.
9. Now right-click on the VHD file from SCAC_Share area, and select the Copy option as shown in the following screenshot:
10. From the middle pane, select Windows Azure and the azurestoragedemoacc01 storage account. Expand and select the vhds container. Right-click on the right pane and select the Paste option, as shown in the following screenshot:
11. Once the VHD file upload job has finished, the uploaded file will show up in the right pane, as shown in the following screenshot:
12. We can also verify a successful upload by logging on to Azure Management Portal and browsing to the Storage account name. Then, selecting Containers tab in the dashboard followed by selecting the vhds container, as shown in the following screenshot:
13. Now, we can use this VHD file during deployment of a new virtual machine in the Azure cloud. We can also create an image file from the VHD files uploaded to the Azure cloud. The image can be used to deploy multiple instances in the cloud services.
Installing the PowerShell module to manage App Controller
In this section, we will install the App Controller PowerShell module as a separate component to a virtual machine. The idea behind this installation is to provide specialized cmdlets to manage App Controller on a machine other than the App Controller server. The following steps walk you through this task:
1. Log on to the machine that requires the module. Copy the App Controller installation media or attach the installation ISO media.
2. Right-click on Setup.exe and select Run as administrator. Once the App Controller setup launches, select the Install Windows PowerShell module for App Controller link, as shown in the following screenshot:
3. On the Windows PowerShell module for App Controller setup wizard dialog box, click on Next.
4. Accept the license agreement and click on Next.
5. On the Destination Folder dialog page, change the installation path if required and click on Next, as shown in the following screenshot:
6. On the Ready to install dialog page, click on Install.
7. On the Completed Windows PowerShell module for App Controller setup wizard, click on Finish, as shown in the following screenshot:
8. Back in the System Center App Controller installation dialog box, click on the Close button.
Introduction to App Controller PowerShell cmdlets
PowerShell enables IT professionals to perform repetitive tasks reliably. Also, there are certain features in the Azure cloud that can only be configured with PowerShell. In this section, we will be introduced to the App Controller PowerShell module.
App Controller PowerShell module provides 29 commands that can be used in the session. In a normal PowerShell console, we can import the cmdlets by importing the App Controller module. This can be achieved by typing the following code in the PowerShell command prompt:
To get the list of commands available in the App Controller module, type the following command in the PowerShell console:
Get-Command -Module AppController
The following screenshot shows the App Controller module:
The following commands are available to be used in the App Controller module:
We also have the ability to connect to the App Controller server under the context of the permission allowed to a specific user. Launch PowerShell ISE as an administrator and run the following script:
Get-SCACServer -ServerName $scac -Credential $cred
A dialog box as shown in the following screenshot appears:
The previous script will pop up a credential dialog for authentication. Once authenticated, all the commands that run against the App Controller server will allow an access level configured for the credentials provided. Please replace the value for $SCAC according to your App Controller environment.
Displaying the App Controller shares in PowerShell
Launch PowerShell for App Controller by searching for applications and typing PowerShell. Right-click and run as administrator. After the console launches, type the following command:
The following path will be displayed:
The previous command will show all the App Controller shares attached to the connected server.
Installing the Windows Azure PowerShell
In this section, we will introduce Windows Azure PowerShell. PowerShell is very good at performing repetitive tasks and most of the time tasks that cannot be performed from the GUI. The following procedure walks you through the steps for installation:
1. Download the Microsoft Azure PowerShell module. At the time of writing this, the module version is 0.8.11 release date 0.0.11. Microsoft Azure PowerShell web installer can be obtained from http://go.microsoft.com/fwlink/p/?linkid=320376&clcid=0x409.
2. Once the installer is downloaded, select Run as administrator. Accept EULA and click on the download button on the Web Platform Installer 5.0 setup wizard. Once the prerequisite software has been downloaded and installed successfully, click on Exit.
3. Search for Azure PowerShell. Right-click on the Microsoft Azure PowerShell application and select Run as administrator, as shown in the following screenshot:
4. Connect to your Azure Subscription via PowerShell. Type the Get-AzurePublishSettingsFile command. This will open a browser window for authentication.
5. After the authentication, download the settings file. Now, back in PowerShell console, type Import-AzurePublishSettingsFile -PublishSettingsFile 'C:\Media\azuresettings.publishsettings'. Here, we saved the settings file as Azure settings.
6. Confirm the Azure connection by typing the Get-Azure Subscription command. This will show details about the current subscription.
In this chapter, we looked into advanced features enabled by App Controller. We covered the migration of a virtual machine VHD file to the Azure cloud, creation of a new storage account in the Azure cloud, installation of the App Controller PowerShell module on a remote machine, connecting PowerShell to Azure subscription, and also the Windows Azure module.
In the next chapter, we will be looking into disaster recovery options available for App Controller.