# Resolve an external service principal in the Databricks account

Launch stage: Beta

`POST /api/2.0/identity/service-principals/resolve-by-external-id`

Resolves a service principal with the given external ID from the customer's IdP. If the service
 principal does not exist, it will be created.
 If the customer is not onboarded onto Automatic Identity Management (AIM), this will return an error.

API scopes: identity

## Request body

- `external_id` (string, required)
  Required. The external ID of the service principal in the customer's IdP.

## Returns

- `service_principal` (object, optional)
  The service principal that was resolved.
  - `account_id` (string, optional, Output only)
    The parent account ID for the service principal in Databricks.
  - `service_principal_id` (string, optional, Output only)
    Internal service principal ID of the service principal in Databricks.
  - `external_id` (string, optional)
    ExternalId of the service principal in the customer's IdP.
  - `application_id` (string, optional, Immutable)
    Application ID of the service principal. Set at creation time and cannot be changed
     afterwards; when omitted, the server generates one.
  - `display_name` (string, required)
    Display name of the service principal.
  - `account_sp_status` (string, required)
    The activity status of a service principal in a Databricks account.
    Possible values:
    - `STATE_UNSPECIFIED`
    - `ACTIVE`
    - `INACTIVE`

## Response

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

