# Create a service principal in the account

Launch stage: GA

`POST /api/2.0/identity/{parent=accounts/*}/service-principals`

Creates a local service principal, which is a service principal that isn't synced from your
 identity provider (IdP).

 If automatic identity management is on, you can't set `external_id`. To add a service
 principal from your IdP, get it as an external service principal instead.

API scopes: identity

## Path parameters

- `parent` (string, required)
  The resource name of the account to create the service principal in, in the format
   `accounts/{account_id}`.

## Request body

The service principal to create.
- `name` (string, optional, 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}`
- `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"
}
```

