Creating multiple TDM Native users through the API
search cancel

Creating multiple TDM Native users through the API

book

Article ID: 401896

calendar_today

Updated On:

Products

CA Test Data Manager (Data Finder / Grid Tools)

Issue/Introduction

Is there any way we can create multiple users in one go in CA TDM portal? I tried using API but keeps getting authentication error.

Environment

TDM Portal 4.11.x

Resolution

You should be able to create multiple users using the APIs, and looping the creation for the number of users you would like to create. As an example, see the attached PowerShell script that can be used to create multiple users using the APIs.

The attached zip file contains an example PowerShell script (Create-TDMUsers.ps1) and a users.csv file. You will need to modify the Create-TDMUsers.ps1 script for your environment, and provide the credentials for logging into TDM Portal, and also modify the users.csv file so that it contains the user information for all the users you would like to create.

NOTE: this is an example script that may or may not run in your environment. It may need to be modified to work with your specific release of PowerShell, which is outside the scope of Broadcom Support.

 Before running the PowerShell script, you need to:

  1. Edit the users.csv file so that it contains the user information for all the users you would like to create.

    Column A = Username, Column B = email address

  2. Configure the Create-TDMUsers.ps1 script so it can work in your environment, by modifying the following variables:
    • $loginUri: replace <HTTP/HTTPS>, <TDM_PORTAL_HOST> with your TDM Portal hostname or IP Address, and <PORT> with the listener port for TDM Portal.  
      For example: 'https://tdmPortalHost.example.com:8443/TestDataManager/user/login?syncLogin=true'

    • $userApiUri: replace <HTTP/HTTPS>, <TDM_PORTAL_HOST> with your TDM Portal hostname or IP Address, and <PORT> with the listener port for TDM Portal.
      For example: 'https://tdmPortalHost.example.com:8443/TestDataManager/api/ca/v1/users'

    • $username: replace <USERNAME> with the Username required to log into TDM Portal.
      For example: 'administrator'

    • $password: replace <PASSWORD> with the password for the user account.
      For example: 'marmite'

  3. To run the script in Powershell:
      • Open a PowerShell with Admin privileges.
      • Navigate to the directory where the script is located.
      • Run the following command: .\Create-TDMUsers.ps1 -CsvPath <PATH to users.csv>
        For example: .\Create-TDMUsers.ps1 -CsvPath .\users.csv

When the script is run, it will first log into TDM Portal and generate a bearer token, then loop through the users found inside the users.csv to create the new native users in TDM Portal.
NOTE: if your Port is using the default self-sign certificate, the Portal connection is not secure, and the script may fail.

It's also possible to do something similar through Javelin, where Javelin logs into Portal, gets the bearer token, and runs the required API, or script to create the users.

Attachments

Create-TDMUsersExample.zip get_app