Skip to main content

Workspace Automation

Overview

Workspace Automation refers to the ability to add custom scripts to your workflows in Workspace. The feature works by adding the ability to attach scripts to Workspace Items that trigger based on a chosen event (such as On User Item Provision).

Workspace provides various events that can be used to execute PowerShell scripts on assignment or removal of a Workspace Item at both customer and user level. Scripts are managed through the Script Upload feature. Visit the Script Upload page for information on accessing and managing scripts within Atria.

This guide will walk you through the process of adding a custom script to a Workspace Item and the configuration options available.

Use Cases for Workspace Automation
  • Use Case : Preparation of application container:

In a scenario where an ISV has a provisioning process for their application, this might involve publishing the application to a desktop, and also behind the scenes it may require a new containerised database to be created and then configured.

To solve this problem, a PowerShell script can be attached to a Workspace Item customer provision event to perform the creation of the new container, whenever a customer is assigned a specific Workspace Item, the automation will run ensuring that the application is automatically setup without needing manual configuration.

  • Use Case : Creating a user in an application database:

The above scenario caters for setting up a new customer with a working application environment. When a user needs to be set up, they may also need to be added to the database and granted access.

By adding automation to the User Assignment event, a script can be executed, it automatically gains the context of the user, and the customer and can subsequently execute the desired process to create the user in the application.

  • Use case : Storage Management:

An application that requires disk or cloud storage may also need to add storage on assignment to a customer. This could also increase limits based on how many users are assigned.

  • Use case : Archiving of data:

Automated process to archive data can be applied when removing a Workspace Item from a user. By adding a script to copy data into an archival folder, data is not lost and process for specific customers is automatically executed.

  • Adding Events to Workspace Type:

Workspace Item Types act as a template and grouping for Workspace Items. If every Workspace Item of that type will require the same automation script to execute, then you should define the event at the Workspace Item Type level. It will then be inherited by every workspace item of this type.

  • Example : Workspace Item Type "User Group Policy": A Workspace Item type is defined that applies group policy based on a users membership of a group.

Automation added that will create the GPO when the Workspace Item is assigned to the Customer. In this case, the automation would be added at the Workspace Item Type level as each Workspace Item needs to run the automation.

Scope and Event

Before adding a script to a Workspace Item, it's important that you decide the scope of the script, and the event that will trigger it.

Scripts can be added to Workspace Items at the global level, or customer level. You will use the Workspace Items page if you want to add a script that is triggered for all customers based on the event, or use the Customer Workspace Items page, if you want to add a script that only applies to one customer. The latter allows for different scripts to be ran when the same item is provisioned to different customers, or their users.

You can also attach scripts to Workspace Item Types, which will trigger the script for all Items of that type. In the case that scripts are present both at the Item level and ItemType level, both scripts will be executed sequentially.

Here are the available event types you can chose to trigger your custom scripts:

Event NameEvent TriggerUse
customer.provisionItem assigned to a customersetup or configuration of applications
customer.deprovisionItem removed from a customerarchiving or deletion of data
user.assignItem assigned to userconfiguration of user, add to external system
user.unassignItem removed from a userarchival, deletion of data related to user

Custom scripts will trigger whenever a customer or user is provisioned with the addition or removal of the Workspace Item.

The Powershell script will target the appropriate environment given the Item Type. For example, if the Item is an Azure item, then the script will automatically authenticate to the Customer in Azure, and execute the script within this context. If the Item's group type is an Active Directory group, then the script will target the Local AD environment.

Script Properties

When an automation is triggered by an Item or ItemType, it is ran with a set of default properties that can be used within the script. These properties are stored in a hashtable named $RequestProperties.

Here are some useful properties that can be accessed through the $RequestProperties hashtable:

Available for all Event Types
Variable NameValue Example
CustomerLongNameTest Customer
CustomerShortNameTC
CustomerKey3
CustomerOUNameTest Customer(TC)
CustomerContactEmailjohn@tc.com
CustomerRolesAttributeextensionAttribute13
PreviouslyProvisionedTrue
ServiceNameWorkSpace
ItemNameMicrosoft Word
ItemDescriptionMicrosoft Word Application
ListNameMS Apps
TypeDesktop Application
CreatedByUserLabelAdmin
CreatedByUserNameAdmin_ASP
CreatedByUserEmailadmin@asp.com
RequestedByUserID1
CreatedByCustomerId1
ScriptEventsOutputVariables.ps1
ServiceScriptsDirectoryPrimaryC:\Program Files\Automate101\Atria\Provisioning Engine\WorkSpace
warning

The variable names are case sensitive. Please ensure you use the exact variable name.

Available for User Event Types
Variable NameValue Example
UsernameJohn_abc
UserID8
UserfullnameJohn Smith
UserEmailjohn@abc.com
UserExternalEmailjohn@abc.com
RecoveryEmailAddressjohn@abc.com
AzureUserIDDBFE7060-A562-4D18-9C58-6684CD55E930
warning

The variable names are case sensitive. Please ensure you use the exact variable name.

The tables above show useful properties in the $RequestProperties hashtable that can be used within your custom scripts. The hashtable expands much further with more details on the user, customer, and item. If you have any queries about what properties can be found or functionality, please contact us at support@getatria.com.

Process

  1. Navigate to the Workspace Item view that suites your needs:
  • Workspace > Workspace Items for scripts that apply to all customers.
  • Workspace > Customer Workspace Items for customer specific scripts. Make sure that the correct customer is in context before navigating to this page.
  • Workspace > Workspace ItemTypes for scripts that you want to apply to multiple items.

Workspace Automation

  1. Click on the item you want to configure, and navigate to the Advanced tab:

Workspace Automation

  1. Click + Add under Provisioning Events:

  2. Select your desired Event Type and Script Name from the drop down and click Save:

Workspace Automation
info

The Script Name drop down contains all of the scripts that you have uploaded via the Script Management page. If you have not already done this, refer to Custom Scripts.

  1. Initiate the event to test the scripts.

Summary

Workspace Automation has limitless possibilities, if you require any help from our team with creating or configuring custom scrips, please contact us at support@getatria.com.