With Canopy Manage, you can automate the process of running scripts on a local or virtual machine. In this example, we will demonstrate setting up a sample PowerShell script samplescript.ps1. We will call this script on the local/virtual machine using an Azure Service Bus.


Custom Canopy Custom Action Template

In order to properly run a custom action on your local computer or Virtual Machine, you will need to include the following files - 


These files can be downloaded in our Custom Action Template zip file.


In order to run the Custom_Python_Template, the local computer or Virtual Machine will need to have Python 3.6 or greater installed (64 Bit is recommended for best compatibility with Powershell scripts). 

You can download the latest Python installation from their website.

Creating a Custom Action - Local/Virtual Machine

The following will list the steps required in creating a custom action in Canopy Manage using the Azure Service Bus. If you have already created the Azure Service Bus, then you can begin at step 3.

1) Create an Azure Service Bus and Queue

For instructions on how to do so, see Microsoft's documentation found here.

For the purposes of this demonstration, we have named our Azure Service Bus queue samplescript.

2) Create Shared Access Policies

For this demonstration we will be using an access policy with Listen Only permissions, and another with Send Only permissions.

For instructions on how to do so, see Microsoft's documentation found here.

Once you have created a SendOnly SAS and a ListenOnly SAS, copy and save the Primary Connection Strings to a document for later reference.

3) Set up scripts + Canopy Manage Resources on local/virtual machine

Once you have downloaded a copy of the Canopy Manage Custom Action Template (via our website Custom Action Template), place these somewhere on your local/virtual machine.

For complete instructions on this step, please see our article Set Up - Custom Action Template.

Steps to Complete - Canopy Manage

Once this is complete, you should now have a python script on your local/virtual machine listening to the Service Bus Queue for this custom action. We can now move into Canopy Manage to set up the Custom Action to be run from there. 

1) Create a Connector 

In order for Canopy Manage to send a request to the Azure Service Bus queue created earlier, we need to give the details to Canopy.

You can find information on how to set-up a Connector in Canopy Manage in our Setting Up Connectors article.

For this connector we used the connection details for our CanopySampleQueue Service Bus queue named samplequeue.

2) Create Custom Fields (optional)

In order to run the Custom Action, Canopy Manage requires a field scheme. If you don't pass any parameters to your custom script you can simply use an empty Field Scheme - however, if you want to pass parameters to your script you will first need to set them.

To do this we need to create Custom Fields. 

Custom Fields allow you to set up the parameters you want to run in your field scheme. Select your field type, in our example we have chosen Single-line text, enter the name of your custom field and then enter a key. It's important to note that the key you enter must match the parameter in your script. 

3) Field Schemes - Custom Actions

A field scheme allows you to add Action or Custom Actions you have created. For more information on setting up Field Schemes please see How Do I Create a Field Scheme?

You can add one or multiple actions to your Field Scheme that can be executed via the actions page. In our example for SampleScript you can see that we have added First Name and Last Name to our scheme. You can also see that to run this action First Name is a required entry field, to set up required entries please see <article>

4) Custom Action

Custom Actions is where all the magic happens and puts together everything you have created so far. We can now create a Custom Action using the connector and field Schemes that we made previously. For more information on the steps to create a Custom Action see our article Creating a New Custom Action.


You can see in our example we have added our SampleScript field scheme we created earlier and the connector CanopySampleQueue.

We will also need to give our Custom Action a key that the Custom Action Template on your local/virtual machine can use to decide which script to call when the Custom Action is executed from Canopy. 


This key needs to be identical to the key used in the "executables" key-value pair on the config.json file. 

For more information on using the Custom Action Template see: Set Up - Custom Action Template