---
title: account service-principals-v2 command group
description: Learn how to use the Databricks CLI account service-principals-v2 commands
canonical_url: https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands
---

# `account service-principals-v2` command group

> [!NOTE]
>
> Databricks CLI use is subject to the [Databricks License](https://github.com/databricks/cli?tab=License-1-ov-file#readme) and [Databricks Privacy Notice](https://www.databricks.com/legal/privacynotice), including any Usage Data provisions.

The `account service-principals-v2` command group within the [Databricks CLI](https://docs.databricks.com/gcp/en/dev-tools/cli/index.md) contains commands to perform create, get, list, update, and delete operations on service principals. Service principals are identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. Databricks recommends creating service principals to run production jobs or modify production data. If all processes that act on production data run with service principals, interactive users do not need any write, delete, or modify privileges in production, which eliminates the risk of a user overwriting production data by accident.

## databricks account service-principals-v2 create

Create a new service principal in the Databricks account.

```
databricks account service-principals-v2 create [flags]
```

#### Options

**`--active`**

 If this user is active.

**`--application-id string`**

 UUID relating to the service principal.

**`--display-name string`**

 String that represents a concatenation of given and family names.

**`--external-id string`**

 External ID.

**`--id string`**

 Databricks service principal ID.

**`--json JSON`**

 Either inline JSON string or @path/to/file.json with request body.

[Global flags](https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands.md#global-flags)

#### Examples

The following example creates a service principal using command-line flags:

```bash
databricks account service-principals-v2 create --display-name "CI/CD Service Principal"
```

The following example creates a service principal using JSON:

```bash
databricks account service-principals-v2 create --json '{"displayName": "CI/CD Service Principal", "active": true}'
```

The following example creates a service principal using a JSON file:

```bash
databricks account service-principals-v2 create --json @service-principal.json
```

## databricks account service-principals-v2 delete

Delete a service principal from the Databricks account.

```
databricks account service-principals-v2 delete ID [flags]
```

#### Arguments

**`ID`**

    Unique ID for a service principal in the Databricks account.

#### Options

[Global flags](https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands.md#global-flags)

#### Examples

The following example deletes a service principal by ID:

```bash
databricks account service-principals-v2 delete 12345
```

## databricks account service-principals-v2 get

Get the details for a single service principal defined in the Databricks account.

```
databricks account service-principals-v2 get ID [flags]
```

#### Arguments

**`ID`**

    Unique ID for a service principal in the Databricks account.

#### Options

[Global flags](https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands.md#global-flags)

#### Examples

The following example gets a service principal by ID:

```bash
databricks account service-principals-v2 get 12345
```

## databricks account service-principals-v2 list

Get the set of service principals associated with a Databricks account.

```
databricks account service-principals-v2 list [flags]
```

#### Options

**`--attributes string`**

 Comma-separated list of attributes to return in response.

**`--excluded-attributes string`**

 Comma-separated list of attributes to exclude in response.

**`--filter string`**

 Query by which the results have to be filtered.

**`--limit int`**

 Maximum number of results to return.

**`--sort-by string`**

 Attribute to sort the results.

**`--sort-order ListSortOrder`**

 The order to sort the results. Supported values: `ascending`, `descending`.

[Global flags](https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands.md#global-flags)

#### Examples

The following example lists all service principals:

```bash
databricks account service-principals-v2 list
```

The following example lists service principals with pagination:

```bash
databricks account service-principals-v2 list --limit 10
```

The following example lists service principals with a filter:

```bash
databricks account service-principals-v2 list --filter "displayName eq \"CI/CD Service Principal\""
```

## databricks account service-principals-v2 patch

Partially update the details of a single service principal in the Databricks account.

```
databricks account service-principals-v2 patch ID [flags]
```

#### Arguments

**`ID`**

    Unique ID in the Databricks workspace.

#### Options

**`--json JSON`**

 Either inline JSON string or @path/to/file.json with request body.

[Global flags](https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands.md#global-flags)

#### Examples

The following example patches a service principal using JSON:

```bash
databricks account service-principals-v2 patch 12345 --json '{"displayName": "Updated CI/CD Service Principal"}'
```

The following example patches a service principal using a JSON file:

```bash
databricks account service-principals-v2 patch 12345 --json @patch-service-principal.json
```

## databricks account service-principals-v2 update

Replace a service principal in the Databricks account.

```
databricks account service-principals-v2 update ID [flags]
```

#### Arguments

**`ID`**

    Databricks service principal ID.

#### Options

**`--active`**

 If this user is active.

**`--application-id string`**

 UUID relating to the service principal.

**`--display-name string`**

 String that represents a concatenation of given and family names.

**`--external-id string`**

 External ID.

**`--json JSON`**

 Either inline JSON string or @path/to/file.json with request body.

[Global flags](https://docs.databricks.com/gcp/en/dev-tools/cli/reference/account-service-principals-v2-commands.md#global-flags)

#### Examples

The following example updates a service principal using command-line flags:

```bash
databricks account service-principals-v2 update 12345 --display-name "Updated CI/CD Service Principal" --active
```

The following example updates a service principal using JSON:

```bash
databricks account service-principals-v2 update 12345 --json '{"displayName": "Updated CI/CD Service Principal", "active": true}'
```

The following example updates a service principal using a JSON file:

```bash
databricks account service-principals-v2 update 12345 --json @update-service-principal.json
```

## <a id="global-flags" />Global flags

**`--debug`**

  Whether to enable debug logging.

**`-h` or `--help`**

    Display help for the Databricks CLI or the related command group or the related command.

**`--log-file` string**

    A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

**`--log-format` format**

    The log format type, `text` or `json`. The default value is `text`.

**`--log-level` string**

    A string representing the log format level. If not specified then the log format level is disabled.

**`-o, --output` type**

    The command output type, `text` or `json`. The default value is `text`.

**`-p, --profile` string**

    The name of the profile in the `~/.databrickscfg` file to use to run the command. If this flag is not specified then if it exists, the profile named `DEFAULT` is used.

**`--progress-format` format**

    The format to display progress logs: `default`, `append`, `inplace`, or `json`

**`-t, --target` string**

    If applicable, the bundle target to use
