The release of XenDesktop 7.5 with support for both Citrix CloudPlatform and Amazon Web Services leverages the elasticity of clouds to simplify the delivery of virtual desktops and Windows apps to the mobile workforce.

I have been working with a small team in the Cloud Platform Group within Citrix towards a process to automate the installation and configuration of XenDesktop 7.5 and Netscaler VPX in order to deliver desktops and applications to end users.

The idea is to automate the installation of all of the infrastructure associated with desktops and application delivery using open source software (for example Active Directory Controllers, SQL Database servers, XenDesktop Controllers, Storefront servers and Netscaler Gateways) whilst the customer (enterprise) administrator takes responsibility for managing desktop images; creating catalogs of desktops and assigning those desktops to users.

A simple example architecture for a XenDesktop installation on top of CloudPlatform is illustrated below. The open and flexible Citrix CloudPlatform is used to run all of the workloads required to deliver desktops and applications.

Early in the project we decided not to be prescriptive about the specific XenDesktop architecture to be deployed, but to provide technologies and samples that can be adapted to automate the provisioning of a wide range of different architectures. To this end we decided to concentrate our efforts in two main directions:

  1. Automation of the process of installing and configuring the desktop and application delivery infrastructure
  2. Simplification of the view presented to a desktop administrator;  in our model the tasks delegated to the desktop administrator are image management, desktop creation and assignment of desktops to users and we wanted a dedicated GUI that provided these features and only these features.

This document will concentrate on the former (automation); for more information on the custom GUI that was developed see [reference].

Automation Technology

The automatic creation of infrastructure required to support a new XenDesktop installation makes use of some open source technologies developed by Citrix and designed to be used in conjunction with Citrix CloudPlatform.

I should point out that these technologies are open source, and unsupported by Citrix. They are provided “as is”  and you are welcome to make use of them subject to the license conditions.


StackMate is broadly equivalent to Amazon CloudFormation (see http://aws.amazon.com/cloudformation/). It provides the capability to provision collections of CloudPlatform resources (e.g. virtual machines, networks, security groups etc.) in a repeatable, ordered fashion. In addition it can push user data onto newly created virtual machines in order to bootstrap the installation of software on the guest operating system, and provides synchronization primitives so that the order of resource creation may be controlled and synchronized.

StackMate is open source software that is freely available to download from GitHub (see https://github.com/stackmate/stackmate).


As well as being able to provision resources such as virtual machines and networks on CloudPlatform, we need to be able to orchestrate the installation and configuration of software on the virtual machines created by StackMate.

This is achieved by use of some complementary technologies that run on the guest operating system of the provisioned virtual machines. These are also available as open source software from GitHub (see https://github.com/siwater/Cloudworks).

Amazon CloudFormation Helper scripts

The open source scripts that Amazon provides to assist with creation of CloudFormation stacks have been ported to work in the Citrix CloudPlatform environment. The reference documentation for these scripts can be found at http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-helper-scripts-reference.html.

The use of the Amazon CloudFormation Helper scripts means that investment that you have already made in developing CloudFormation templates for building systems in the AWS environment may now be easily ported to CloudPlatform, as the metadata format for the two environments is identical.

PowerShell scripts

The Amazon CloudFormation Helper scripts typically invoke scripts in order to install and configure software on the guest Windows operating system. We have developed a comprehensive library of PowerShell scripts to fully automate the installation tasks required to install a full Citrix XenDesktop environment on the CloudPlatform virtual machines. Tasks such as

  • Create / Join Active Directory Domain, Rename Computer etc.
  • Create Domain Trust, configure DNS, and configure KMS etc.
  • Install XenDesktop Controller, install VDA (for both client and server OS)

Overall the library composes more than 40 PowerShell scripts.

Cloudworks Agent

The pattern used to bootstrap the Amazon CloudFormation Helper scripts in the AWS environment requires that an agent is present on the virtual machine in order to execute script fragments passed to the virtual machine on start-up as user data.

This capability is provided in the CloudPlatform environment by a Windows Service that is installed on the CloudPlatform template.

Integrated WiX installer

An integrated Windows installer (packaged as an MSI file) is also included in the Cloudworks suite in order to simplify the installation of the Cloudworks Agent and Amazon CloudFormation Helper scripts onto a Windows guest operating system.
StackMate Operation

The following diagram illustrates the operation of StackMate. The Cloudworks agent and Amazon CloudFormation Helper scripts must be pre-installed on the CloudFormation template.

The instructions for building the CloudPlatform stack are encoded in a StackMate template (simple JSON file) that is processed by StackMate. When a virtual machine is created, a script fragment is passed to the Cloudworks agent in user data, typically this script fragment will bootstrap the CloudFormation Helper scripts which then read and process the metadata required to install and configure the required software on the Windows virtual machine

Once the CloudFormation Helper scripts have completed the installation of the software on the Windows virtual machine they can signal completion of the operation to StackMate, enabling correct sequencing of the installation of multi-virtual machine systems.

Quick Start with StackMate

I have provided links above to the GitHub repositories for the open source StackMate and Cloudworks technologies; you are free to download the source, and build it for your own use.

However, if you are like me and prefer to download something that you can actually get started with straight away you may be interested in the packaged StackMate appliance that we have built. This consists of

  • A StackMate appliance (packaged as a XenServer XVA file) that contains a working StackMate installation together with a range of sample JSON templates, and scripts to invoke StackMate
  • A pre-built Cloudworks integrated installer (packaged as an MSI file) that you will need to install on your CloudPlatform templates
  • A step-by-step guide to getting started with your first StackMate system

Download the appliance from https://citrix.sharefile.com/d/s18212b9c23945549