Ivanti provides many Ivanti software or 3rd party software connectors for Ivanti Automation on the Ivanti Marketplace (https://marketplace.ivanticloud.com/). Most of the connectors use Variables and need to be created before a connector Task is used in a Module.
This blog describes how to create Global Variables by importing in bulk from a CSV file with Ivanti Automation. This blog includes the Building Block for Ivanti Automation which can be found at the end of the blog.
Variables function as placeholders for specific values. There are 3 types of variables:
- Text (value 0)
- Password (value 1)
- Credentials (value 2)
- Text is the most used with insecure values.
- Password only holds password and is encrypted during the full process when used.
- Credentials hold username and password, which is encrypted during the full process when used.
Example of the 3 types of variables.
Variables can be categorized. Two options are available in the Variables. Create a new Variable Category and new Variable.
Connectors include Variables which are obvious not available in the Variables list. When selecting a specific Action and the Variables are not created the action shows the new Variables to be created.
When the Variables used by the connector are created the connector action doesn’t show the New global variables. See the differences in the screenshots.
Manual creating the Variables is a time-sensitive job, and for some connectors that host 5 or more Variables, it’s back-and-forth between the action and check the full name (must be identical as in the connector) and add the Variable.
But what is Connector Action? Connector Actions are the possible options a connector executes. Some connectors have more options with actions.
For example, the VMware vCenter holds multiple options with multiple actions. All the options in the screenshot below are in the installed VMware vCenter connector. The actions are in blue behind the option.
Because I build a lot of labs for customers with multiple integrations that use the connectors, the need to create the variables in the new Ivanti Automation was a time-sensitive action.
So I started to investigate if importing the needed variables in bulk was possible. First, I checked all the database tables but couldn’t find the variables in any of the tables. After more investigation, I found the Variables in the table tblSettings in the line with lngSettings is 13. But too much information. Created a PS script to extract the data into XML. The script reads a CSV file, which is added to the Resources. The first action is downloading the Resource file in a folder, which is added in an Ivanti Automation Parameter. The next in the module is checking the folder path. If the folder path misses a slash at the end, this task will add the slash.
The next step is the most important action. This PowerShell task resolves the data from the database, deciphers the data to XML, adds the new Categories and Variables to the XML, and the last step is importing the cyphered data back into the database.
The last task in the module is to remove the temporary folder for storing the CSV resource.
The screenshot below shows the steps executed.
The resource used as CSV file is shown in the screenshot below. The Ivanti Automation Building Block includes 2 files.
- module_add global variables to the ia database.xml
- module_add global variables to the ia database.xbb
When importing the building block, there is no passkey required. Importing a building block is described in this link.
There are 5 Ivanti Automation Parameters in the Module:
- SQL Server Name (Enter the SQL Server DNS Name or FQDN)
- IA Database Name (Enter the name of the Ivanti Automation database)
- IA Database Username (Enter the Ivanti Automation Database Username)
- IA Database Password (Enter the Ivanti Automation Database Password)
- Temp_Folder (Enter a local folder (i.e. C:\Data). The folder is automatically created and removed.)
These values must be entered when executing the job. When using SQL Authentication, enter the SQL Username and Password. When using Windows Authentication, enter a domain account that has access to the Ivanti Automation database.
After the import of the building block, open the PowerShell Task, which executes the Variables import. Select the Settings tab and add a Security Context. This is not optional for the task. The Security Context must be a domain account that has access to the SQL Server.
Editing the CSV Resource can be executed from the resource. Edit the Resource by selecting the Edit button.
Notepad opens with a temporary file.
The CSV is already provided with the most common connector Variables. Of course, more can added but also removed. Be aware the script will not remove existing Variable Categories or Variables. So, removing values from the CSV resource will not remove them from the Variables list.
When the file is changed, close Notepad, and the file is saved. Select OK to close and store the new file in the Ivanti Automation resource.
Next is scheduling the module.
In below screenshot I already have some Variable Categories and Variables.
Schedule the Module, add the agent to run on, and enter the Parameter values.
Select the tab Job Parameters and enter the Parameter values.
When finished, select OK. When the job is finished, select Variables from the Library. More Variables are added in the corresponding Category.
The last step is checking the Job History. Select Jobs – Jobs History. Double-click the job and select the tab Tasks. Select the third job that import the Variables. Next, select the Agent which executed the job. Select the tab Console Output.
The Console Output shows which Variables are newly created or skipped because they already exist.
After the bulk import of the Ivanti Automation Variables, the values can be added.
Download “Global Variable bulk import BB”module_add-global-variables-to-the-ia-database-1.zip – Downloaded 484 times – 4.95 KB