Building a Reporting Application with Microsoft Azure RemoteApp
Before I say anything else, let’s lay down a ground rule that I wish all blogs would follow: A sample that takes more than 30 minutes to get cranking up is a project. Get ready to learn about Azure RemoteApp applications by building a SAMPLE that would be powered by Microsoft Azure.
What is Azure RemoteApp?
The cloud world is pretty biased towards web applications. What does cloud offer for your Windows Applications that you want many people to use without you worrying about scaling the underlying infrastructure while still maintaining fine grained control over who gets access to which applications?
Answers to that question are critical when you want to save business costs and\or improve enterprise agility. For instance, you want to provision an application temporarily for some contractors, or, you have an enterprise application to enable your mobile workforce, which you want a managed set of people to access from any device, including phones. Another scenario might be that you are in are in the process of developing an application and you want to set up test benches for your testers and developers without having each one of them spend time setting up the applications themselves. Hosting your Windows applications on cloud can also help you with securing your application binaries as no one can copy your application binaries and simply walk away with them. There is no limit to scenarios that can be realized, if your windows applications run on cloud.
Microsoft Azure allows you to deploy your windows applications in cloud and allows your users to use Remote Desktop (or RDP) to access these applications. This offering from Microsoft Azure is termed as Azure RemoteApp. Let us build a sample and take this service for a test drive. We will keep learning about the various facets of Azure RemoteApp along the way.
Since the most common scenario that most windows applications cater to is capturing user input and generating reports from that data after applying some manipulations, a decent sample application should be able to capture user input and generate a simple report from it. If we can do so within thirty minutes, Azure RemoteApp would have proved its utility.
The sample application that we will build is a single form WPF application with two simple reports embedded in it. One of the reports will render how much each employee is earning and another report will render the fraction of income of each employee with respect to the overall compensation. You can use the steps mentioned here to create a simple WPF form with the report viewer embedded in it or download the sample application that I built from here.
I am using VS 15 Community Edition, .Net framework 4.0 and Microsoft Report Viewer 14 to build the application. The application will use a Microsoft Azure SQL Database to store data from which it would serve the report. I did not build a form to capture user data and I am sure you would appreciate the great lack of skills I have with respect to UX and design, but I will get better with time and I invite you to contribute to any sample that I have on GitHub. Follow the steps as mentioned below:
- Create an empty Microsoft Azure SQL Database in your Azure account by following the steps mentioned here. Make sure that you have configured the firewall rules properly.
- Copy the database connection string from the portal.
- Use the connection string to populate the database with EmployeeSalary table by publishing the database project provided in the sample (take help of steps mentioned here).
- Add some sample data to the EmployeeSalary table that you just created. I generally use Server Explorer available in VS itself as explained here.
- Paste the connection string in connection strings section of App.config file of RemoteAppDemo project.
- Start the RemoteAppDemo project on your local system. You should be able to see a screen that looks likes this:
Now that we have a sample application ready, let’s move it to a VM that will run on cloud. There are two ways to do this currently:
- Create your own VM based on the guidelines presented here.
- Create RemoteApp images (which hold the apps you share in your collection) from an Azure virtual machine. The simplest way to do this is to use “Windows Server Remote Desktop Session Host” image available in the image gallery.
As a note, I would like to mention that if you want to migrate your applications to Azure RemoteApp, you should read the compatibility guidelines here. Now let’s create an Azure VM from “Windows Server Remote Desktop Session Host” image available in the image gallery. Steps for doing this are really simple:
- Log in to your account.
- Create VM using “Windows Server Remote Desktop Session Host” image from image gallery. If you need help creating VM using the image gallery, follow the steps mentioned here.
- Once your VM finishes provisioning, log into your VM.
- Now you can either build an installer for your project using ClickOnce or just copy paste your application binaries in system root directory (I pasted the Debug folder). It is recommended to use an installer when you are deploying in production environment.
The environment is pretty raw at the moment, you would need to install ReportViewer 14 by adding it as a prerequisite in ClickOnce deployment or by installing it from Microsoft Download Center. You would also need to make sure that correct .net framework is available on the server. One thing that tripped me is that SQL Server CLR Types were missing from the server which you can install from here. Run your application within the VM to see if everything is still intact.
Now we just need to supply image of this VM to Azure RemoteApp. Navigate to the desktop on the VM and search for ValidateRemoteAppImage.ps script. Click to execute the script and proceed through the steps to validate server image and sysprep it. Following are the steps to create and configure your RemoteApp (if these steps change, refer this link):
- In the management portal, go to the RemoteApp page.
- Click New > Quick Create.
- Enter a name for your collection, and select your region.
- Choose the plan that you want to use - standard or basic.
- Choose the template (or image) that got created by executing the steps mentioned earlier for this collection.
- Click Create RemoteApp collection.
Now you need to tell Azure RemoteApp that you want to publish your reporting application. From the RemoteApp publishing page, click Publish to add your program. Here you can publish either from the Start menu of the template image or by specifying the path on the template image for the app. Since we have pasted the binaries in system directory, we need to provide a name for the app and the path to where it is installed on the template image (don’t use drive names, use system variables such as %SYSTEMDRIVE%).
The last step is to provide access to users.
- From the Quick Start page, click Configure user access.
- Enter the work account (from Active Directory) or Microsoft account (I used this in sample) that you want to grant access for. Make sure that you use the “firstname.lastname@example.org” format.
- After the users are validated, click Save.
We are done. Ask your users to download RemoteApp client for their phones, tablets or desktop from the link mentioned on the dashboard of your RemoteApp and login using the identities you configured in the RemoteApp.
Enjoy their WOWs!! Here are some screenshots from my devices.
- Desktop and Tablet (Windows)
- Phone (Windows)
Your 2 cents
GET SMARTER!Stay up to date with interesting posts like these. Take a moment to subscribe!
- Continuous TeX Document Production with GitHub Actions
- IoT Edge Device Monitoring and Management with Azure Durable Entities Functions - Part 2
- IoT Edge Device Monitoring and Management with Azure Durable Entities Functions - Part 1
- Building a GraphQL Application with ASP.Net Core and TypeScript - Part 2
- Building a GraphQL Application with ASP.Net Core and TypeScript - Part 1