Groups CLI

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.

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.

List groups

databricks groups list
{
  "group_names": [
    "admins"
  ]
}

List the members of admins

databricks groups list-members --group-name admins
{
  "members": [
    {
      "user_name": "adminA@example.com"
    },
    {
      "user_name": "adminB@example.com"
    }
  ]
}

Add group finance

databricks groups create --group-name finance
{
  "group_name": "finance"
}
databricks groups list
{
  "group_names": [
    "admins",
    "finance"
  ]
}