Embotics® vCommander® multi-tenancy is very powerful and flexible, and allows for completely unique experiences for each organization’s members, whether these are customers for service providers, or business units in the enterprise. The process of adding a new Tenant to a Multi-Tenant vCommander system involves several steps and can take a significant amount of time to perform manually. To speed up this process we’ve prepared a sample PowerShell script which automates many of the actions required in the onboarding process.


This script performs the following actions:

  • Creates an Organization for the new Tenant in vCommander
  • Adds a new Owner for the Organization from a connected Active Directory system
  • Creates a VM Folder on the selected vCenter for the new Tenant and a set of sub-folders under that root folder
  • Creates a new Deployment Destination using a selected Datastore, Datacenter, Cluster, VM Folder and Network and configures the new Organization with the new Deployment Destination
  • Configures the CPU, Storage and Memory Quota for the new Organization


This article will guide you through installing and configuring the New Tenant Onboarding scripts in your vCommander system.


Requirements


Additionally, this script assumes you have connected a vCenter system and an Active Directory system to your vCommander install.


Create Required Custom Attributes


The first step in configuring the Onboarding script is to create Custom Attributes. These custom attributes must be created to allow you to configure the various Deployment Destination options.

Custom Attribute names should match the list below. The Sync Custom Attributes script expects certain attribute names to function properly.


You will need to create the following Custom Attributes in your vCommander system:

Custom Field Name:

Custom Field Type:

Edit in Service Portal:

Description:
Organization Name
Text
True
This is the name of the new Tenant's organization.
Organization Manager Email
Text
True
This is the email address of the manager for the new organization.
CPU Quota
Text
True
This is the CPU quota (# of CPUs) allowed the new Tenant's organization
Memory Quota
Text
True
This is the Memory quota (GB of RAM) allowed the new Tenant's organization
Storage Quota
Text
True
This is the Storage quota (GB of HDD space) allowed the new Tenant's organization
Destination Folders List
Text
True
This is a comma separated list of Folders which will be created for the Tenant in vCenter. For example: Production, Testing, Development



For details on creating a Custom Attribute please see this article.



Additional Custom Attributes will be automatically created by the Sync Custom Attributes script so you do not need to manually create them. They are detailed below for reference:


Custom Field Name:

Custom Field Type:

Description:
Managed Systems
List
This is the list of managed systems that you can choose from when onboarding the Tenant. This defines which VMware system the Tenant is hosted on.
Data Center
Sublist of Managed Systems list
This is the list of Data Centers under the selected Managed Systems.
Datastore
Sublist of Managed Systems list
This is the list of Datastores under the selected Managed Systems.
Cluster
Sublist of Managed Systems list
This is the list of Clusters unders the selected Managed Systems.
Network
Sublist of Cluster list
This is the list of Networks under the selected Cluster.


Preparing the Required Script Files


The New Tenant Onboarding and Sync Custom Attribute scripts should be placed in a Scripts folder on the root of the PC. The script files should be placed in “C:\Scripts\”. The Onboarding and Sync Custom Attribute scripts assume that other required files will also be in the “C:\Scripts\” folder.


The New Tenant Onboarding script requires minor modifications to function. The “Edit these for your Environment” section in the Onboarding script details the variables you need to set to make use of the New Tenant Onboarding script.

Likewise, the Sync Custom Attributes script includes an “Edit these for your Environment” section which details the variables you need to set to make use of the Sync Custom Attributes script.


Please review both files and set the required variables as per the notes in the scripts.


Creating required Credentials Files


Several credentials files must be created to allow the scripts to connect to the vCommander server, vCenter server and, optionally, the Active Directory server.

All the credentials should be placed in the “C:\Scripts\” folder along with the script files.

  • The vCommander Credential file should be named “vCommanderCreds.xml
  • The vCenter Credential file should be named “VCenterCreds.xml
  • The Active Directory Credential should be named “ADCreds.xml


Instructions to create the encrypted credentials can be found in our support portal here.


Create a Command Workflow for Sync Custom Attributes


The Onboarding process uses values stored in a set of Custom Attributes. Those attributes are populated using the Sync Custom Attributes script which can be executed using a Command Workflow.

  1. Log into your vCommander Admin portal and select Configuration -> Command Workflows from the main menu.
  2. Next, click the Add button to create a new Command Workflow. Name the new workflow “Onboarding Custom Attribute Sync” and set the Target Type to “All Types”. Select Next.

  3. On the Steps page, click the Add button and choose the “Execute Script” option. In the Command Line field, enter the following and then click Next:

    powershell.exe  -ExecutionPolicy Bypass  &{C:\scripts\Sync_Custom_Attributes.ps1}


  4. On the Permissions page chose any Organizations or Users which you want to have access to this Workflow. You can also choose to allow everyone to access the workflow. Click Next.
  5. Click Next on the Options page and then click Finish on the Summary page.


This Workflow must be run once before you can use the New Tenant Onboarding Service. The script will populate the Managed Systems, Cluster, Data Center, Datastore and Network custom attributes so that you can select them when performing the New Tenant Onboarding Service request.

  1. To run the workflow, select Views->VMs and Templates from the top menu. 
  2. Navigate the tree on the left, locate any VM. Right click the VM and select Run Workflow.
  3. Select the Onboarding Custom Attribute Sync workflow and click Run.
  4. The script will run and populate the required custom attributes. Check the Task an Workflow results in vCommander to see the result and confirm that the workflow and script processed correctly.

Additionally, you can schedule the script to run regularly which will keep the various systems which are tracked using these custom attributes up to date. Windows Task Scheduler can be used to run the script on a schedule using the Powershell command in Step 3 above.



Create a Service for New Tenant Onboarding


Now that we’ve created the custom attributes and populated them we can create the Service to allow you to onboard a new tenant.


  1. Log into your vCommander Admin Portal, select Configuration -> Service Request Configuration. Then click the Add Service button to create a new service.
  2. Enter the name as “New Tenant Onboarding” and click the Next button.
  3. On the Component Blueprint page click the Add button and select New Component. Name the new component “Onboarding Task” and enter whatever annual cost is appropriate for Onboarding for your organization. Click Add to Service and then click Next.
  4. On the Onboarding Task page, select the Attributes tab. Click the Add Attributes link and add the following attributes:  

    Organization Name
    Storage Quota
    Datastore
    Organization Manager Email
    Destination Folders List
    Cluster
    CPU Quota
    Managed Systems
    Network
    Memory Quota
    Data Center



  5. Next, click the Form tab and add each of the Attributes above to the form as form elements.  All the fields should be set as Required. Click Next once all the form elements have been added.
  6. On the Deployment page, click the Add Workflow link. Name the workflow “New Tenant Workflow” and click Next.
  7. On the Steps page, click the Add button and select the Execute Script item. Enter the following in the Command Line box and click Next and then click Finish:

    powershell.exe  -ExecutionPolicy Bypass  &{C:\scripts\New_Tenant_Onboarding.ps1 '#{request.id}'}


  8. Click Next. On the Visibility page select the Organizations, Users and Groups you wish to publish the workflow for. Normally this is published only to your administrators group. Click Next and then click Finish on the Summary page.


Now you can request the New Tenant Onboarding any time you want to add a new Tenant and simply fill in the form fields - the script will then handle creating the Organization, adding the Manager, setting the Quota and creating Folders and Deployment Destinations for the Tenant automatically.