CHAPTER 9

image

Azure RemoteApp

Cloud computing offers individuals access to data and applications from nearly any point of access to the Internet, offers businesses a whole new way to cut costs for technical infrastructure, and offers big computer companies a potentially giant market for hardware and services.

—Jamais Cascio

Nowadays, in an increasingly mobile world where sitting in the office in front of your desktop is no longer needed to do your tasks, 52% of information workers across 17 countries report using three or more devices for work.1 It’s very important for corporations to ensure that their employees are experiencing the core line-of-business (LOB) applications across these devices, keeping in mind that most devices are not Windows.

One of the strategies for enabling these mobile users is to build a phone app for each platform—Windows Phone, iOS, and Android. But sometimes (actually, most of time in specific industries) users get custom-made software from an independent software vendor (ISV), and unfortunately, this software doesn’t support smart operating systems.

Thus, you find yourself stuck with a native Windows application, which you cannot install on iOS or Android, of course, and due to some critical business needs, you want give some users (if not all of them) remote access to it. The remote access could be provided via a technology such as a virtual private network (VPN) or DirectAccess, thus allowing users to connect via remote desktop to the office’s computer to do their work.

Another solution for such a problem is to use application virtualization software such as Microsoft RemoteApp, which delivers Windows applications to users on any device, anywhere.

This chapter discusses creating and configuring an Azure RemoteApp environment via RemoteApp PowerShell cmdlets.

What’s Azure RemoteApp?

RemoteApp started a long time ago in Windows Server as Remote Desktop Services (RDS) (formerly known as Terminal Services). Recently, it became one of Azure’s hosted services, rather than building infrastructure, firewalls, load-balancers, and so forth, on-premise. Now, with less effort, you can get your RemoteApp environment up and running while Microsoft takes care of the storage, user density, high availability, and other operational and administrative tasks, as is the case with other Azure services.

RemoteApp delivers virtual applications, which means that you don’t have to install anything on your device—whether it’s Windows, iOS, or Android. The RemoteApp application is integrated with the device’s desktop and it appears as if it is running locally.

Actually, the moment you click the app’s shortcut, an RDP session (because it runs on top of RDS) is initiated; the RemoteApp application runs in its own resizable window, which can be dragged between multiple monitors and has its own entry in the taskbar.

Azure RemoteApp and PowerShell

The Azure PowerShell module comes with 34 cmdlets (as of this writing) that allow automating a variety of tasks, such creating templates, building collections, assigning users, and more.

Building Your First Azure RemoteApp Environment

In the next sections, you learn about RemoteApp-related cmdlets by building a complete RemoteApp scenario from scratch.

Step 1: Building an Azure RemoteApp Custom Image

Microsoft RemoteApp is about having a Windows Server machine running a Remote Desktop Session Host (RDSH) role service; it has one or more applications installed and configured on it. These applications are published and delivered to users via RemoteApp, which is backed by RDSH.

The first step is to build the Windows Server machine. You create a Windows Server 2012 R2 virtual machine (VM), install an RDSH role, install the applications to be published, and finally generalize the machine using the SysPrep tool to make an image. These steps sound easy and smooth, but are a little long.

What if you don’t want to go through all of these steps? Are there any other options? Yes, there are.

The first option is to use one of the default template images that come with Azure RemoteApp. You use the Get-AzureRemoteAppTemplateImage cmdlet to list the available images, both default and custom.

# List Azure RemoteApp Template Images
Get-AzureRemoteAppTemplateImage | Select Name

Name
----
Office 365 ProPlus (Subscription required)
Office Professional Plus 2013 (30-day trial)
Windows Server 2012 R2

The default template images are Windows Server 2012 R2 and Microsoft Office 365 Office ProPlus. The template names describe what each template contains. You have a template for Windows Server 2012 R2, Windows Server 2012 with Office Professional Plus 2012, and a template for Windows Server 2012 R2 with Office 365 ProPlus.

You can read more information about each template at https://azure.microsoft.com/en-us/documentation/articles/remoteapp-images/.

The second option is to build the template using the Azure VM image that is preconfigured with RDSH and ready to be used with RemoteApp. This VM image has Windows Server 2012 R2 with an RDSH role installed, and it has a PowerShell script to validate the RemoteApp image requirements and generalize them. What does that mean? It means that all you have to do is simply install the applications.

To build an Azure VM using the RDSH image, from the Azure portal, create a virtual machine from the gallery and search for the Windows Server Remote Desktop Session Host image (see Figure 9-1).

9781484206669_Fig09-01.jpg

Figure 9-1. Windows Server Remote Desktop Session Host—VM image

You can refresh your memory here with PowerShell. Let’s recall Chapter 4. Remember the VM cmdlets? First, let’s get the list of available VM images by using the Get-AzureVMImage cmdlet, and then filter the result to get only the images with RDSH. Unlike the Azure portal, which shows only the latest image, the Get-AzureVMImage cmdlet retrieves all versions of the RDSH images, so you have to sort the output by the PublishedDate property in descending order and then select the most recent one.

# List Azure VM Image for Remote Desktop Session Host (RDSH)
$RDSH_Image = Get-AzureVMImage | `
Where Label -like "Windows Server Remote Desktop Session Host*" | `
Select Label, ImageName, PublishedDate, RecommendedVMSize | `
Sort PublishedDate -Descending | `
Select -First 1 | fl

$RDSH_Image

Label         : Windows Server Remote Desktop Session Host on Windows Server 2012 R2
ImageName     : ad072bd3082149369c449ba5832401ae__Windows-Server-Remote-Desktop-Session-Host-on-Windows-Server-2012-R2-20150513-0525
PublishedDate : 5/13/2015 6:00:19 AM
RecommendedVMSize: Large

Now that you have the RDSH VM image name, the next step is to create a VM with that name using the New-AzureQuickVM cmdlet. It generates an RDP file using the Get-AzureRemoteDesktopFile cmdlet and saves it on the desktop so that you can use it to connect to the template to finalize the configuration.

# Provision Azure VM - Windows Server 2012 with RDSH
$RemoteAppVM = New-AzureQuickVM -Windows `
-Name RemoteAppTemplate `
-ServiceName ’myRemoteAppTemplates’ `
-ImageName $RDSH_Image.ImageName `
-Password Microsoft@123 `
-AdminUsername SherifT `
-AffinityGroup "AAGWE01" `
-InstanceSize $RDSH_Image.RecommendedVMSize

# Generate RDP file
$FileName = $RemoteAppVM.Name + ".rdp"
Get-AzureRemoteDesktopFile -ServiceName $RemoteAppVM.ServiceName `
-Name $RemoteAppVM.Name `
-LocalPath $homeDesktopAzureRDPs$FileName

Once you finish the VM creation and generate the RDP file, connect to the VM and install any application that you want. For the sake of this scenario, install Google Chrome and change any of the settings; for instance, bookmark a web page or change the home page. Then run the PowerShell script called ValidateRemoteAppImage, which is located on the desktop (see Figure 9-2).

9781484206669_Fig09-02.jpg

Figure 9-2. ValidateRemoteAppImage script

Image Note  For the Azure RemoteApp to automatically detect the installed app on the custom image, make sure to add the application shortcut to the Start menu. Otherwise, it won’t be detected and you will have to publish the application using its full path, such as C:Program Files (x86)GoogleChromeApplicationchrome.exe.

The script shown in Figure 9-2 validates the image configuration against the RemoteApp requirements; it lets you know whether you need to fix something or if you are good to go.

If the current image configuration satisfies all the requirements for Azure RemoteApp, then it asks you to launch SysPrep to generalize the machine and shut it down.

So far, you have an Azure VM configured to be an Azure RemoteApp template image, but it’s not an image yet. To do that, you need to first add this VM as an image in the Azure VM library. To achieve this task, you need to capture the VM using the Save-AzureVMImage cmdlet.

# Capture Azure VM Image
Save-AzureVMImage -ServiceName ’myRemoteAppTemplates’ `
-Name ’RemoteAppTemplate’ `
-ImageName "RemoteAppTemplatev1" `
-ImageLabel "my Azure RemoteApp Template" `
-OSState Generalized

You are almost there. The last step in creating a RemoteApp template image is to import the VM template from the Azure VM library. It’s a little confusing, but it is very important to differentiate between the Azure VM image and the Azure RemoteApp template image. The former is stored under the Azure VM library and used to create an Azure VM (see Figure 9-3), whereas the latter is stored under RemoteApp and is used to create Azure RemoteApp collections (see Figure 9-4).

9781484206669_Fig09-03.jpg

Figure 9-3. Azure VM image library

9781484206669_Fig09-04.jpg

Figure 9-4. Azure RemoteApp template images

To create an Azure RemoteApp template image using the Azure VM image stored in the VM library, you use the New-AzureRemoteAppTemplateImage cmdlet.

# Create Azure RemoteApp Template Image
New-AzureRemoteAppTemplateImage -ImageName RemoteAppwithChrome `
-Location ’North Europe’ `
-AzureVmImageName ’ RemoteAppTemplatev1’

Id                        : 4074fc94-1bf3-4cff-9898-309c179d4649
Name                      : RemoteAppwithChrome
NumberOfLinkedCollections : 0
OfficeType                : None
PathOnClient              :
RegionList                : {North Europe}
Sas                       :
SasExpiry                 : 1/1/1900 12:00:00 AM
Size                      : 0
Status                    : UploadPending
TrialOnly                 : False
Type                      : CustomerImage
UploadCompleteTime        : 1/1/0001 12:00:00 AM
UploadSetupTime           : 7/5/2015 9:17:50 PM
UploadStartTime           : 1/1/0001 12:00:00 AM
Uri                       :

Once you execute the New-AzureRemoteAppTemplateImage cmdlet, the template status appears on the portal as Upload Pending and it remains for a minute or two; it changes to Import in progress and finally changes to Ready once the process is complete. The Ready status means that you are ready for the next step.

Before moving on to the next step, however, it’s important that I mention two more cmdlets related to RemoteApp template images. The first is the Rename-AzureRemoteAppTemplateImage cmdlet, which is used to rename the existing RemoteApp template image.

# Rename RemoteApp Template Image
Rename-AzureRemoteAppTemplateImage -ImageName RemoteAppTemplateWithChrome `
-NewName RemoteAppTemplateWithLOBs

Id                        : 178d7946-28a7-494f-b701-0db730b86271
Name                      : RemoteAppTemplateWithLOBs
NumberOfLinkedCollections : 0
OfficeType                : None
PathOnClient              :
RegionList                : {West Europe}
Sas                       :
SasExpiry                 : 1/1/1900 12:00:00 AM
Size                      : 136365212160
Status                    : Ready
TrialOnly                 : False
Type                      : CustomerImage
UploadCompleteTime        : 7/5/2015 2:16:35 AM
UploadSetupTime           : 7/5/2015 1:45:58 AM
UploadStartTime           : 7/5/2015 2:14:37 AM
Uri                       : https://cdvwe014626977rdcm.blob.core.windows.net/goldimages/178d7946-28a7-494f-b701-0db730b86271.vhd

The second cmdlet is the Remove-AzureRemoteAppTemplateImage cmdlet, which is used to remove the RemoteApp template image.

# Remove RemoteApp Template Image
Remove-AzureRemoteAppTemplateImage -ImageName RemoteAppTemplateWithLOBs

Now, let’s the move to the next step.

Step 2: Creating an Azure RemoteApp Collection

After creating the Azure RemoteApp template image, the next step is to create your first RemoteApp collection. A RemoteApp collection is basically where you configure applications, data stores, user assignments, and so on. When you create a collection, Azure creates a VM using the RemoteApp template image that you selected.

You won’t have access to this machine, but you have access to its configuration or Azure portal. It’s very similar to the idea of web site hosting. A web site is hosted on a web server; and although you don’t have access to the server, you can manage it via a control panel.

Azure RemoteApp has two types of collections: a cloud collection and a hybrid collection. Both collections are hosted on and store data on Azure. Users can access an application using their Active Directory credentials, whether synchronized using Azure Active Directory Connect or federated via Active Directory Federation Services (ADFS).

The only difference between cloud and hybrid collections is that the latter allows access to data and resources stored on the local network. This means that you need to integrate the Azure RemoteApp collection with the Azure virtual network connected to the local network via either ExpressRoute or site-to-site VPN.

To create an Azure RemoteApp collection, you use the New-AzureRemoteAppCollection cmdlet. This cmdlet works for both cloud and hybrid collections, but the parameters differ.

The following parameters are used to create a cloud collection:

  • -CollectionName: Specifies a name for the new RemoteApp collection.
  • -ImageName: Specifies the name of the RemoteApp template image that will be used to create the collection.
  • -Plan: Specifies which pricing plan will be used for the collection. The available plans are Basic and Standard. You can get the RemoteApp plans using the Get-AzureRemoteAppPlan cmdlet. You can read more about these plans at http://azure.microsoft.com/en-us/pricing/details/remoteapp/.
  • -Location: Specifies the Azure region that will host the collection. You can get the RemoteApp locations by using the Get-AzureRemoteAppLocation cmdlet.
  • -Description: Describes the collection.

So by putting the previous parameters in action, the final command should look like the following.

# Create Azure RemoteApp Cloud Collection
New-AzureRemoteAppCollection -CollectionName ’col1’ `
-ImageName ’RemoteAppTemplateWithChrome’ `
-Plan Basic `
-Location ’North Europe’ `
-Description ’Chrome Application’

TrackingId
----------
71a3dc4c-9818-494c-aa11-2f4a03e01e00

The collection-provisioning process takes time, usually 30 minutes or more. The cmdlet returns a tracking id that can be used with the Get-AzureRemoteAppOperationResult cmdlet to get the current status of the process.

# Track Status of Collection Provisioning Process
Get-AzureRemoteAppOperationResult -TrackingId 71a3dc4c-9818-494c-aa11-2f4a03e01e00 | fl

Description  : CreateFreshDeployment_Domain
ErrorDetails :
Status       : InProgress

If you want to create a hybrid collection, first you need to ensure that you have Azure virtual network created and connected to your on-premises network. Then, run the New-AzureRemoteAppCollection cmdlet with the same parameters that you use to provision a cloud collection (except the -Location parameter), in addition to the following parameters.

  • -VNetName: Specifies the Azure virtual network that the collection will be linked to.
  • -SubnetName: Specifies which subnet in the virtual network will be used to assign addresses to the RemoteApp collection.
  • -DnsServers: Specifies the DNS server configuration for the collection if the DNS Server is not configured for the virtual network.
  • -Domain: Specifies the local domain that the RDSH servers will join.
  • -Credentials: Specifies the credentials of the service account that will be used to join the RDSH servers to the domain.
  • -OrganizationalUnit: Specifies which organizational unit that the RDSH server computer object will be stored.

Image Note  You don’t use the -Location parameter because you use the same location configured in the virtual network.

# Create Azure RemoteApp Hybrid Collection
New-AzureRemoteAppCollection -CollectionName ’col1’ `
-ImageName ’RemoteAppTemplateWithChrome’ `
-Plan Basic `
-Description ’Chrome Application’
-VNetName ’S2SvNET’ `
-SubnetName ’ARAsubnet’ `
-Domain ’Company123.com’ `
-Credentials (Get-Credential [email protected]

TrackingId
----------
34u2e016-9818-494c-xx78-2f4a03e01e35

You can modify the settings of the collections that you have just created by using the Set-AzureRemoteAppCollection cmdlet. This cmdlet allows you to modify the collection plan from Basic to Standard, and vice versa, via the -Plan parameter. You can update the credentials of hybrid collections via the -Credential parameter. And you can set the RDP redirection options via the -CustomRdpProperty parameter.

Table 9-1 shows the available redirection options and their PowerShell value.

Table 9-1. Azure RemoteApp Redirection Options

Redirection Option

Setting Value

Enabled

Play sounds on the local computer (Play on this computer)

audiomode:i:0

Yes

Captures audio from the local computer and sends it to the remote computer (Record from this computer)

audiocapturemode:i:1

Yes

Print to local printers

redirectprinters:i:1

Yes

COM ports

redirectcomports:i:1

Yes

Smart card devices

redirectsmartcards:i:1

Yes

Clipboard (ability to copy and paste)

redirectclipboard:i:1

Yes

ClearType font smoothing

allowfontsmoothing:i:1

Yes

Redirect all supported Plug and Play devices

devicestoredirect:s:*

Yes

Drive redirection (drive mapping)

drivestoredirect:s:*

No

USB redirection

usbdevicestoredirect:s:*

No

Thus, to enable the drive and USB redirection for the Azure RemoteApp collection, the code should look like the following.

# Setting Azure RemoteApp Collection CutomRdpProperty
Set-AzureRemoteAppCollection -CollectionName col1 `
-CustomRdpProperty "drivestoredirect:s:*`nusbdevicestoredirect:s:*"

If you want to disable one of the default redirection settings, then make sure to replace the number 1 (at the end of the settings value) with 0; for example, if you want to disable smart card redirection, then replace the redirectsmartcards:i:1 with redirectsmartcards:i:0.

# Disable Smartcard Redirection
Set-AzureRemoteAppCollection -CollectionName col1 `
-CustomRdpProperty "redirectsmartcards:i:0"

Image Note  Make sure to log out all users before applying the redirection settings changes.

As part of collection maintenance, it might happen that you need to update, install, or even remove an application. So, instead of rebuilding the collection from scratch, republishing the applications, and reassigning the users, you can use the RemoteApp collection update capability, which allows you to in-place update the existing collection using a new RemoteApp template image while keeping the existing configuration.

To update an Azure RemoteApp collection via PowerShell, you use the Update-AzureRemoteAppCollection cmdlet along with the -CollectionName parameter to specify the collection to update and -ImageName to specify the name of the Azure RemoteApp template image used to update the collection. You can also use the -ForceLogoffWhenUpdateComplete parameter to log out all connected users and force them to reconnect to the updated collection. Otherwise, users are alerted that they must log out within 60 minutes, so that they have enough time to save their work.

# Update Azure RemoteApp Collection
Update-AzureRemoteAppCollection -CollectionName col1 `
-ImageName RATemplateWithBrowsers `
-ForceLogoffWhenUpdateComplete

TrackingId
----------
cc6a72bc-b408-42d4-8586-b5ee9c9d5dbd

You must do the update process manually for RemoteApp custom template images. However, if you are using a default RemoteApp template image, then you don’t have to worry about it because Microsoft takes care of it.

Once the RemoteApp collection is ready (whether a new collection or an updated collection), you are ready to publish the programs.

Step 3: Publishing Azure RemoteApp Programs

Now that you have the RemoteApp collection ready, it is time to publish the programs you installed on the RemoteApp template image. To publish a RemoteApp program, you use the Publish-AzureRemoteAppProgram cmdlet along with the -FileVirtualPath parameter to specify the file path of the program executable file, and the -DisplayName parameter to specify the name of the application. Also, you can use the -CommandLine parameter to specify any additional parameter for that program. For instance, if you want to run Microsoft Word in safe mode, you use the -CommandLine parameter with value ’/s’.

You installed Google Chrome while preparing the RemoteApp custom template image. The following code shows how to publish it.

# Publish RemoteApp Program - Google Chrome
Publish-AzureRemoteAppProgram -CollectionName col1 `
-FileVirtualPath "C:Program Files (x86)GoogleChromeApplicationchrome.exe" `
-DisplayName ’Google Chrome’

If the program you are trying to publish is a Start menu program, then you can replace the -FileVirtualPath parameter with the -StartMenuAppId parameter. You can get the Start menu programs by using the Get-AzureRemoteAppStartMenuProgram cmdlet.

# Get RemoteApp Start Menu Programs
Get-AzureRemoteAppStartMenuProgram -CollectionName col1

CommandLineArguments :
IconPngUris          : {[32, https://cdvne015027925rdcm.blob.core.windows.net/icons/1a67d7cd-5311-47b7-81b1-3a6354763e0f.png?sv=2012-02-12&se=2015-07-06T22%3A49%3A05Z&sr=b&sp=r&sig=VHoBYt45qScPrTXxt6koF%2FhzZKLMRDU3UNkfNVQ32Do%3D]}
IconUri              : https://cdvne015027925rdcm.blob.core.windows.net/icons/c55176df-506d-4cc4-8885-d6402cd93b3a.ico?sv=2012-02-12&se=2015-07-06T22%3A49%3A05Z&sr=b&sp=r&sig=s6grcLbqb7%2BKmHYckdQqmff1BTSeROUzagbUFPotzvM%3D
Name                 : Calculator
StartMenuAppId       : acc5f0f8-9f08-4fd6-aa61-3297fea5886b
VirtualPath          : %SYSTEMDRIVE%WindowsSystem32calc.exe

CommandLineArguments :
IconPngUris          : {[32, https://cdvne015027925rdcm.blob.core.windows.net/icons/4d92d0a3-996b-46cd-a8ea-9987888b8c30.png?sv=2012-02-12&se=2015-07-06T22%3A49%3A05Z&sr=b&sp=r&sig=lmCGUaSrwsc7zdLFrPwWyFqicRa69PbmgZVLbIdtipw%3D]}
IconUri              : https://cdvne015027925rdcm.blob.core.windows.net/icons/783c9d15-133f-43bd-83b2-251dcc693e9d.ico?sv=2012-02-12&se=2015-07-06T22%3A49%3A05Z&sr=b&sp=r&sig=NtWG9pcUXK2%2B5qTeb0Lqd0DmMd22MXahCmn2ikzxgtI%3D
Name                 : cmd
StartMenuAppId       : b2a864fd-8959-4177-b692-f47ca22dbda7
VirtualPath          : %SYSTEMDRIVE%WindowsSystem32cmd.exe

CommandLineArguments :
IconPngUris          : {[32, https://cdvne015027925rdcm.blob.core.windows.net/icons/dadb6671-9558-4141-8e44-2ced7ba0ae37.png?sv=2012-02-12&se=2015-07-06T22%3A49%3A05Z&sr=b&sp=r&sig=RyJcEoSYBnb1uJh%2BwvKxd1JzWFfGOOvLeO9Erh8GQGk%3D]}
IconUri              : https://cdvne015027925rdcm.blob.core.windows.net/icons/cd9171b2-38c9-4b94-8c92-0ad23266c5dc.ico?sv=2012-02-12&se=2015-07-06T22%3A49%3A05Z&sr=b&sp=r&sig=TrQITpe0g4aXlHcfKTP%2Fqk6OuiIEZ%2BGOgi8yLmX%2BeC0%3D
Name                 : InternetExplorer
StartMenuAppId       : 0fdf8ce9-429a-44e9-9add-f3afccac3fce
VirtualPath          : %SYSTEMDRIVE%Program FilesInternet Exploreriexplore.exe

To unpublish a program, you use the Unpublish-AzureRemoteAppProgram cmdlet along with the -Alias parameter to specify the alias of the program to unpublish. You can get the aliases by using the Get-AzureRemoteAppProgram cmdlet.

# Get RemoteApp Program Alias
$Prog  = Get-AzureRemoteAppProgram -CollectionName col1 | `
Where Name -eq ’Google Chrome’ | `
Select Alias

# Unpublish RemoteApp Program
Unpublish-AzureRemoteAppProgram -CollectionName col1 -Alias $Prog.Alias

At this stage, you are just one step away from getting everything done and ready to work.

Step 4: User Assignment

The final configuration step is the user assignments, in which you define which users have access to the RemoteApp collection. The users you add could be from Microsoft accounts or Azure AD accounts.

You use the Add-AzureRemoteAppUser cmdlet along with the -Type parameter to specify the user account type, whether MicrosoftAccount or OrgId, and you use the -UserUpn parameter to specify the user’s UPN.

# Add Azure RemoteApp User
Add-AzureRemoteAppUser -CollectionName col1 `
-Type OrgId `
-UserUpn [email protected]

To remove user access, you use the Remove-AzureRemoteAppUser cmdlet with the same parameters, like the Add-AzureRemoteAppUser cmdlet.

# Remove Azure RemoteApp User
Remove-AzureRemoteAppUser -CollectionName col1 `
-Type OrgId `
-UserUpn [email protected]

Once you finish the user assignment process, go to the web site at http://remoteapp.windowsazure.com. Go to the Download page and select the client for your operating system. There is one available for Windows, Windows Phone, Android, iOS, and Mac OS X.

Install the application and log in using your corporate credentials (or Microsoft account) to go to the RemoteApp workspace and get to your applications (see Figure 9-5).

9781484206669_Fig09-05.jpg

Figure 9-5. Azure RemoteApp workspace—Windows OS

In Figure 9-5, the workspace name appears to the user as Work Resources. You can change this name to whatever you want by using the Set-AzureRemoteAppWorkspace cmdlet.

# Set RemoteApp Workspace Name
Set-AzureRemoteAppWorkspace -WorkspaceName ’Company123 Workspace’

This code changes the workspace name from Work Resources to Company123 Workspace.

Finally, you can congratulate yourself. You built the RemoteApp template image, created the RemoteApp collection, published a program, and assigned access to users. Now you have users connected to the Azure RemoteApp environment, which means that you have a session.

The next section explains how to manage RemoteApp sessions.

Managing Azure RemoteApp Sessions

First off, to manage a session, you need to know which session you have, the state of the session (whether active or idle), the connected users, and their logon times. For the purpose of this task, you’ll use the Get-AzureRemoteAppSession cmdlet to query all RemoteApp sessions for a specific collection.

# List RemoteApp Sessions
Get-AzureRemoteAppSession -CollectionName col1

LogonTimeUtc                         State        UserUpn
------------                         -----        -------
6/25/2015 11:15:10 PM                Connected    [email protected]
6/25/2015 10:19:34 PM                Connected    [email protected]

Once you know who is connected, you can decide the next action. You can disconnect these sessions by using the Disconnect-AzureRemoteAppSession cmdlet, log out of a session by using the Invoke-AzureRemoteAppSessionLogoff cmdlet, or send a message to all connected sessions by using the Send-AzureRemoteAppSessionMessage cmdlet.

# Disconnect RemoteApp Session
Disconnect-AzureRemoteAppSession -CollectionName col1 `
-UserUpn [email protected]

# Logoff All RemoteApp Sessions
$Sessions = Get-AzureRemoteAppSession -CollectionName col1

ForEach ( $s in $Sessions )
{
Invoke-AzureRemoteAppSessionLogoff -CollectionName col1 `
-UserUpn $s.UserUpn
}

# Send Message to All RemoteApp Sessions
$Sessions = Get-AzureRemoteAppSession -CollectionName col1

ForEach ( $s in $Sessions )
{
Send-AzureRemoteAppSessionMessage -CollectionName col1 `
-UserUpn $s.UserUpn `
-Message "You Session will be terminated in 60 minutes. Please, save you what you doing now."
}

Sending a message to connected users is very important, especially if you just updated the collections. All users are forced to log out, so, you might want to warn them to save their work.

When we talk about sessions and active users, it means that there is a service being consumed; it’s important to have an idea about the usage of this service.

The RemoteApp PowerShell has two cmdlets that get usage information for an Azure RemoteApp collection. The Get-AzureRemoteAppCollectionUsageSummary and the Get-AzureRemoteAppCollectionUsageDetails cmdlets are responsible for getting this kind of usage information. These cmdlets show you what you can get from the RemoteApp collection dashboard on the Azure portal.

Summary

In this chapter, you learned about the Azure RemoteApp service and its PowerShell cmdlets via a full end-to-end RemoteApp scenario. You started by building an Azure RemoteApp custom template with a Google Chrome application, and then you used the RemoteApp template image to create a RemoteApp collection.

While creating the RemoteApp collection, you built another custom image that had some changes and you used it to update the existing RemoteApp collection. Finally, you published the application inside the collection and assigned access to these applications to corporate users.

Also, you learned how to manage the connected session and take actions such as disconnecting a session, logging off a session, and sending a message to the active sessions.

Finally, you finished the chapter with getting RemoteApp usage information using PowerShell cmdlets.

________________________

1Forrester Research, “BT Futures Report: Info workers will erase boundary between enterprise & consumer technologies,” https://www.forrester.com/Info+Workers+Will+Erase+The+Boundary+Between+Enterprise+And+Consumer+Technologies/fulltext/-/E-res77881, February 21, 2013.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.20.231