# Update a service principal in the account

Launch stage: GA

`PATCH /api/2.0/identity/{name=accounts/*/service-principals/*}`

Updates a service principal. Only the fields in `update_mask` change.

 If automatic identity management is on and the service principal has an `external_id`, you can
 only update `external_id`. Its other fields come from your identity provider. A service
 principal can't deactivate itself, and you can't update service principals that Databricks
 manages.

API scopes: identity

## Path parameters

- `name` (string, required, ID, Immutable)
  The resource name of the service principal, in one of these formats:
     - Account APIs: `accounts/{account_id}/service-principals/{service_principal_id}`
     - Workspace APIs: `service-principals/{service_principal_id}`

## Query parameters

- `update_mask` (string, required)
  The fields to update, separated by commas. You can update `display_name`,
   `account_sp_status`, and `external_id`.

## Request body

The service principal to update. Its `name` identifies the service principal.
- `external_id` (string, optional)
  The ID of the service principal in your identity provider (IdP).
- `application_id` (string, optional, Immutable)
  The service principal's application ID, a UUID. If you don't set it when you create the
   service principal, Databricks generates one. It must be unique in the account and can't be
   changed.
- `display_name` (string, required)
  The service principal's display name.
- `account_sp_status` (string, required)
  Whether the service principal is active in the account.
  Possible values:
  - `ACTIVE`
  - `INACTIVE`

## Returns

Returns the ServicePrincipal object.

## Response

```json
{
  "name": "string",
  "parent": "string",
  "account_id": "string",
  "service_principal_id": "string",
  "external_id": "string",
  "application_id": "string",
  "display_name": "string",
  "account_sp_status": "ACTIVE"
}
```

