Managing Global Roles via the Command Line

You can use the datasphere command line interface to list global roles and the users assigned to them and to add users to and remove users from them.

Prerequisites

To manage global roles and privileges via the command line, you must have a global role that grants you the following privileges:
  • Data Warehouse General (-R------) - To access SAP Datasphere.

  • Role (CRUD----) - To access the (Roles) and (Authorization Overview) areas in the (Security) tool and to create, update, and delete roles.

  • User (-------M) - To add users to roles.

The DW Administrator global role, for example, grants these privileges. For more information, see Privileges and Permissions and Standard Roles Delivered with SAP Datasphere.
You must, in addition: To browse the available commands, enter the following and press Return:
datasphere global-roles

For general information about working with global roles in SAP Datasphere , see Assign Users to a Role.

List Global Roles

You can list the global roles in your tenant, and optionally write them to a file.

Enter the following command and press Return:
datasphere global-roles list
     [--output <file>.json]
Complete the parameters as follows:

Parameter

Description

--output <file>.json

[optional] Enter a path to a .json file to write the output to.

If you do not include this option, the output will be printed to the command line.

List Users in a Global Role

To read the list of users added to a global role and optionally write it to a file, enter the following command and press Return:
datasphere global-roles users list
    --role <ID>
    --output <file>.json
Complete the parameters as follows:

Parameter

Description

--role <id>

Enter the ID of a global role.

--output <file>.json

[optional] Enter a path to a .json file to write the output to.

If you do not include this option, the output will be printed to the command line.

For example, to write the list of users added to the global role Custom_Administrator to the file admins.json , enter the following command and press Return:
datasphere global-roles users list --role Custom_Administrator --output admins.json

Add Users to Global Roles

You can add users to a global role.

Enter the following command and press Return:
datasphere global-roles users add
    --role <ID> 
    --users <userID[,userID...]>
Complete the parameters as follows:

Parameter

Description

--role <id>

Enter the ID of a global role.

--users <userID[,userID...]>

Enter a comma-separated list of user IDs.

For example, to add the users AADAMS and SSMITH to the global role Custom_Administrator, enter the following command and press Return:
datasphere global-roles users add --role Custom_Administrator --users AADAMS,SSMITH

Remove Users from Global Roles

You can remove users from a global role.

Enter the following command and press Return:
datasphere global-roles users remove
    --role <ID> 
    --users <userID[,userID...]>
Complete the parameters as follows:

Parameter

Description

--role <id>

Enter the ID of a global role.

--users <userID[,userID...]>

Enter a comma-separated list of user IDs.

For example, to remove the users AADAMS and SSMITH from the global role Custom_Administrator, enter the following command and press Return:
datasphere global-roles users remove --role Custom_Administrator --users AADAMS,SSMITH