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.

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.

databricks groups add-member \
--parent-name sql-users \
--user-name someone@example.com
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.

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

Delete a group

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

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

List available groups

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

databricks groups list
{
  "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.

databricks groups list-members --group-name sql-users
{
  "members": [
    {
      "user_name": "someone@example.com"
    }
  ]
}
databricks groups list-members --group-name sql-power-users
{
  "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.

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

Remove a member from a group

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

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

If successful, no output is displayed.