If an organization does not have LDAP or Azure AD as part of default authentication, then users are to be added manually to HCP. Also for the guest users, this is a regular activity.
If there is a need to import bulk local users or many guest users for one time only into HCP, then the below description would help to achieve the same.
- Write a shell (for Linux) or power-shell script (for Windows) following HCP API documentation and run it. This script should read data from a CSV file and import directly to HCP.
For more information, please get in touch in HCP API documentation:
- Download our readymade shell script (attached to this article) and do the necessary adjustment before running and upload user information from local CSV file.
We would focus more on the second point here:
- Download EveryonePrint script: HCP_Add_User_via_API.sh
- Open the file in Notepad++ (or other word editor) in Windows and change the following:
- Change hcpserver=”HCP_Primary_Account_DNS_address” #CHANGE HCP ACCOUNT DOMAIN NAME
- Change the INPUT with user details contained CSV file (the script and the CSV file should be in the same directory while running)
- Specify the columns in the CSV and mention them in line 51: making sure that the script reads all columns and get the data.
- Update the curl command with necessary input parameters.
For example, if the CSV provides 8 fields per user, the API field parameters should match the same. If you need to add 4 fields to each user, the filed names should be updated in the CURL command.
- Run dos2unix command to the CSV file (dos2unix abc.csv)
Finally place the shell script and the CSV file in the Linux server (within same directory), provide permission to run (sudo chmod 755 HCP_Add_User_via_API.sh) and then run the script. All the user details would be updated in HCP.