user-mgmt upsert-user

Use a *.json file to create a new user or update an existing user.

Syntax

cpd-cli user-mgmt upsert-user \
--data=<json-file-name> \
--profile=<cpd-configuration-profile-name> \
[--cpdconfig=<cpd-configuration-location>] \
[--replace-roles] \
[--verbose]

Arguments

The upsert-user command has no arguments.

Options

Option Description
--cpdconfig The Cloud Pak for Data configuration location.
Status
Optional.
Syntax
--cpdconfig=<cpd-configuration-location>
Default value
$HOME/.cpd-cli/config
Valid values
A valid Cloud Pak for Data configuration location.
--data The *.json file name that describes user details.
Status
Required.
Syntax
--data=<json-file-name>
Default value
No default.
Valid values
A valid *.json file name.

--help

-h

Display command help.
Status
Optional.
Syntax
--help
Default value
No default.
Valid values
Not applicable.
--profile The profile-name from the Cloud Pak for Data configuration.
Status
Required.
Syntax
--profile=<cpd-configuration-profile-name>
Default value
default
Valid values
Any valid profile name from the Cloud Pak for Data configuration.
--replace-roles Replace roles for the existing group with new roles.
Status
Optional.
Syntax
--replace-roles
Default value
Not applicable.
Valid values
Not applicable.
--verbose Logs include more detailed messages.
Status
Optional.
Syntax
--verbose
Default value
No default.
Valid values
Not applicable.

Examples

Note: The following examples use the recommended installation environment variables.

Use a script to create environment variables with the correct values for your environment. For more information, see Best practice: Setting up install variables.

Use a user.json file to update an existing user.
cpd-cli user-mgmt upsert-user \
--data=user.json \
--profile=<cpd-configuration-profile-name>

Sample user.json file.

{
   "username":"user1",
   "displayName":"user1",
   "email":"user1@company.com",
   "user_roles":[
      "cpd_user_role"
   ],
   "password":"password"
}