Microsoft has recently announced a new feature of Windows Azure called RemoteApp that allows Windows applications to be hosted on Azure and then run via RDP on the desktop as well as mobile devices, including iOS and Android devices. We’re going to look to see how well that works for a PowerBuilder application.
The RemoteApp feature, at the time this blog was written, is in preview, and is available free of charge for developers to try out. Azure itself also has a 30 day free trial program going. However, there can be a rather long delay between the time you sign up for the RemoteApp preview and when it is approved. In my case, my 30 day free trial of Azure was expiring by the time I got approval for RemoteApp, and so I had to obtain a pay-as-you-go subscription for Azure and apply for RemoteApp access again using the new subscription. Note also that the notice they send letting you know that your RemoteApp access was approved is sent to the Microsoft account email address (e.g., hotmail, outlook.com, live.com) that you used to register, so you need to monitor that email address.
RemoteApp comes in two flavors: Cloud and Hybrid. The Cloud version is for hosting applications that can run entirely within Azure, include Microsoft Office applications and a few other Microsoft programs provided on the default image, as well as your own custom applications that do not require access to remote resources. The Hybrid version is for applications that need to access a database or other on-premise resources, and involve the creation of a site-to-site VPN link to allow the Azure cloud to securely access your on-premise resources. This is a significant feature, as one of the stumbling blocks for many companies for moving to a public cloud offering has been the security and control over their database resources. By providing a Hybrid option that leaves the database resources on-premise, Microsoft has taken great strides in overcoming those objections.
For the purpose of this walkthrough, we’re going to create a custom template image which includes a PowerBuilder application that does not need to access a database (I decided to use the FreeCell sample app from the Sybase CodeXchange site). We’ll then do a straight Cloud deployment. We’re going to follow the instructions at How to create a custom template image for RemoteApp and How to create a cloud deployment of RemoteApp to do so.
Windows Azure and Remote App Access
The first step, obviously, is to create an account on Windows Azure and then obtain access to the RemoteApp service. You can sign up for the free 30 day Azure account at Microsoft Azure Free Trial: Try Azure | Azure Free Trial or the Pay as You Go plan at Pay-As-You-Go. Once you have one of those, you can request access to RemoteApp via this page: RemoteApp.
Install Azure PowerShell
You’ll need to have Azure PowerShell installed on your local machine in order to upload the custom template image to Azure. Instructions on obtaining and installing Azure PowerShell can be found at How to install and configure Azure PowerShell
Obtain a Windows Server 2012 R2 Image
The template image we’re going to create will be a customization of a Windows Server 2012 R2 image. Therefore, you will need to obtain a DVD or ISO file to use to install on the image. I used my MSDN Operating System account to obtain an ISO image. Note that images obtained through MSDN are only for development purposes, you would need to obtain a retail license for Windows Server 2012 R2 to move to production.
Create a VHD file
There’s a great walk-through on how to create a VHD file on Windows 7 at: Create and Use a Virtual Hard Disk on Windows 7. The guide on creating the custom template image also has some pretty good instructions. First, access the Disk Management tool via Control Panel -> System and Security -> Administrative Tools -> Computer Management:
1. Right-click Disk Management and then click Create VHD. Follow the prompts that appear.
2. Right-click the new disk and then click Initialize Disk. Click OK.
3. Right-click the new disk and then click New Simple Volume (or select a different volume type, if available). Follow the prompts that appear.
Obtain a Microsoft Hyper-V Product
You’ll need to install Windows Server 2012 R2 on the VHD file, install your application, and then configure the image using one of Microsoft’s Hyper-V offerings. Two options are Microsoft Hyper-V Server 2008 R2 and Microsoft Hyper-V Server 2012 R2. Both are command line only server products. The 2008 version is available free of charge. The 2012 is available as an unlimited evaluation. I tried both of them, but found that setup and configuration of them was too much effort to justify. To use the server products you need to run the Hyper-V manager from another machine and deal with a huge number of configuration issues to get the two machines to talk to one another. If that’s something you feel comfortable with, more power to you. Otherwise, you might want to consider the third option.
I ended up with the third option, which is to use the Hyper-V manager built into Windows 8.x. Since I didn’t want to dedicate a physical machine for this purpose, I created a virtual Windows 8 machine using VMPlayer, which is available free of charge for non-commercial purposes. Once again, I used my MSDN Operating Systems account to obtain a Windows 8.1 image. One thing you need to make sure you do when you create the Windows 8 virtual machine is change the Guest Operating System Version from “Windows 8” to “Hyper-V (unsupported)”. That’s because VMPlayer is a Hyper-V server, but it needs to allow Windows 8 to see hardware support for Hyper-V as well so it’s Hyper-V capability will work.
What’s interesting is that once you get Windows 8 Hyper-V running and install the Windows Server 2012 image on the VHD and start that, you’ll actually have *three* different Hyper-V products running, one inside another, in a sort of Matryoshka doll configuration. VMPlayer -> Windows 8 -> Windows Server 2012.
Install Windows 2012 R2 on the VHD image file
Once you have Windows 8 (or one of the other Hyper-V products), open the Hyper-V manager, connect to the server (in the case of Windows 8 the manager just connects to the process running on the Windows 8 machine), right click and select “New -> Virtual Machine”. At the “Specify Generation” page of the wizard, leave it set to Generation 1. On the “Connect Virtual Hard Drive”, choose the “Use an existing virtual hard disk” option and select the VHD file you created earlier. In the “Installation Options” subpage, you can point to the DVD or ISO image that has the Windows Server 2012 R2 setup on it.
Start and configure the Windows Server 2012 R2 image
Once Windows Server 2012 R2 is installed on the VHD file, start up the image and perform the customization steps listed in the custom template image guide. In particular:
- Enable the Remote Desktop Services role and Desktop Experience.
- Install your application and ensure that it runs on the custom template image.
- In order to expose your application as a RemoteApp, it needs to appear on the Start Menu. To do that, create a shortcut and then copy that shortcut to the %SYSTEMDRIVE%\Program Data\Windows\Start Menu\Programs directory. (You can also publish by path once the service is provisioned, but adding the shortcut to the Start Menu is easier).
- Disable the file encrypting system
- Sysprep the image
The image will shut down as the final steps of the sysprep. At this point you need to copy the modified VHD file from the Windows 8 image back to the computer that has the Azure PowerShell installed on it.
Upload the custom template image
Go back into the Azure Management Console, and under the “RemoteApp” tab select “Template Images” and then the option to “Upload a Template Image”.
Once you give the template image a name, the management console will provide you with a script and a command to run using the script that you will need to run under an elevated privileges Azure PowerShell command prompt.
Do that by searching for the Azure PowerShell, and then right clicking on it and running it as Administrator
Then navigate to the directory where the script file downloaded from the Azure site is located, and paste in the command to run.
Once you grant it access to run, it will prompt you for the location of the custom template image. The script will then calculate an MD5 hash for the file and preform the upload. On my machine with an Intel i7 processor and a 75/75 FIOS line, it takes approximately 30 minutes to calculate the hash and another 30 minutes to do the upload for a 8GB VHD file.
Create a RemoteApp Service
Now that you have loaded a custom template image, go back into the Azure Management Console -> RemoteApp -> RemoteApp Services and click the option to create a new service. In the dialog that appears, choose “Quick Create”, give it a name, and then select your custom image from the drop down for template images.
At that point, Azure will start provisioning the RemoteApp service, which can take 30 minutes or more.
Publish RemoteApp Applications
Once the RemoteApp service has been provisioned, click on it to open up the Quick Start menu. From that menu, select the “Publishing” option.
You have a choice between selecting programs that appear on the Start Menu or just specifying the path to the application.
Since we added the program to the Start Menu, we’ll choose that option. The system will then provide us with a list of the programs on the images Start Menu. From that, select the application(s) you want the users to have access to. In this case, we’ll make the custom app we added to the image available.
Download the RemoteApp client to your desktop and/or mobile device(s) and access the app
We’re ready to run the application. For the desktop, you can obtain the RemoteApp client from the following location: Microsoft Azure RemoteApp. For mobile devices (i.e., iOS, Android) you can download them from the respective app stores (iTunes or Play Store). I don’t have (or want) a Windows based mobile device, so I can’t address how to install the client there.
Once the client is downloaded, run it and login to Azure. For the mobile device apps, this may involve selecting an “Add RemoteApp” option on the client menu. The application you published should appear, and you can run it from the device.
Here’s what the client and application looks like when running RemoteApp from my Windows desktop:
Here’s the client menu and application running on my iPad mini:
And finally, here is the client menu and application running on my Samsung Galaxy S5 (Android):
It appears that changes in orientation are not supported on mobile devices (or at least I didn’t figure out how to support it). It seems I was restricted to landscape mode.
Also note that since this is based on Remote Desktop, my signing in on a second device while the app was running in an initial device did not start up a new instance of the application. It just transferred control of the original instance of the application to the more recent device login. Of course, this only applies to logins from the same users, but it is an interesting and potentially useful feature of Microsoft’s implementation.
Finally, it may be possible to create the custom image entirely within Azure using the virtual machine options they provide. I’ll leave that as an exercise for the reader.