Skip to main content

Groups CLI (legacy)

important

This documentation has been retired and might not be updated.

This information applies to legacy Databricks CLI versions 0.18 and below. Databricks recommends that you use newer Databricks CLI version 0.205 or above instead. See What is the Databricks CLI?. To find your version of the Databricks CLI, run databricks -v.

To migrate from Databricks CLI version 0.18 or below to Databricks CLI version 0.205 or above, see Databricks CLI migration.

note
  • The Groups CLI requires Databricks CLI 0.8.0 or above.
  • You must be a Databricks administrator to invoke this API.

You run Databricks groups CLI subcommands by appending them to databricks groups. These subcommands call the Groups API.

Bash
databricks groups --help
Usage: databricks groups [OPTIONS] COMMAND [ARGS]...

Provide utility to interact with Databricks groups.

Options:
-v, --version 0.8.0
--debug Debug Mode. Shows full stack trace on error.
--profile TEXT CLI connection profile to use. The default profile is "DEFAULT".
-h, --help Show this message and exit.

Commands:
add-member Add an existing principal to another existing group.
Options:
--parent-name TEXT Name of the parent group to which the new member will be
added. This field is required. [required]
--user-name TEXT The user name which will be added to the parent group.
--group-name TEXT If group name which will be added to the parent group.
create Create a new group with the given name.
Options:
--group-name TEXT [required]
delete Remove a group from this organization.
Options:
--group-name TEXT [required]
list Return all of the groups in a workspace.
list-members Return all of the members of a particular group.
Options:
--group-name TEXT [required]
list-parents Retrieve all groups in which a given user or group is a member.
Options:
--user-name TEXT
--group-name TEXT
remove-member Removes a user or group from a group.
Options:
--parent-name TEXT Name of the parent group to which the new member will be
removed. This field is required. [required]
--user-name TEXT The user name which will be removed from the parent
group.
--group-name TEXT If group name which will be removed from the parent
group.

Add a member to a group

To display usage documentation, run databricks groups add-member --help.

Bash
databricks groups add-member \
--parent-name sql-users \
--user-name someone@example.com
Bash
databricks groups add-member \
--parent-name sql-power-users \
--group-name sql-users

If successful, no output is displayed.

Create a group

To display usage documentation, run databricks groups create --help.

Bash
databricks groups create --group-name sql-users
Console
{
"group_name": "sql-users"
}

Delete a group

To display usage documentation, run databricks groups delete --help.

Bash
databricks groups delete --group-name sql-users
Console
{}

List available groups

To display usage documentation, run databricks groups list --help.

Bash
databricks groups list
Console
{
"group_names": [
"sql-users",
"sql-power-users",
"sql-admins"
]
}

List the members of a group

To display usage documentation, run databricks groups list-members --help.

Bash
databricks groups list-members --group-name sql-users
Console
{
"members": [
{
"user_name": "someone@example.com"
}
]
}
Bash
databricks groups list-members --group-name sql-power-users
Console
{
"members": [
{
"group_name": "sql-users"
}
]
}

List the groups to which a user or group belongs

To display usage documentation, run databricks groups list-parents --help.

Bash
databricks groups list-parents --user-name someone@example.com
Console
{
"group_names": [
"sql-users"
]
}
Bash
databricks groups list-parents --group-name sql-users
Console
{
"group_names": [
"sql-power-users"
]
}

Remove a member from a group

To display usage documentation, run databricks groups remove-member --help.

Bash
databricks groups remove-member \
--parent-name sql-power-users \
--group-name sql-users
Bash
databricks groups remove-member \
--parent-name sql-users \
--user-name someone@example.com

If successful, no output is displayed.