Skip to main content

service_principals

Creates, updates, deletes, gets or lists a service_principals resource.

Overview

Nameservice_principals
TypeResource
Iddatabricks_account.iamv2.service_principals

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
account_idstringThe parent account ID for the service principal in Databricks.
application_idstringApplication ID of the service principal.
external_idstringExternalId of the service principal in the customer's IdP.
internal_idstringInternal service principal ID of the service principal in Databricks.
display_namestringDisplay name of the service principal.
account_sp_statusstringThe activity status of a service principal in a Databricks account. (ACTIVE, INACTIVE)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, internal_idFetches a service principal from the Databricks account by its internal ID.
listselectaccount_idfilter, page_size, page_tokenLists the service principals in the Databricks account, returning one page per call. Supports
createinsertaccount_id, service_principalCreates a service principal in the Databricks account and returns the resulting ServicePrincipal
updateupdateaccount_id, internal_id, update_mask, service_principalUpdates an existing service principal in the Databricks account. Only the fields named in the update
deletedeleteaccount_id, internal_idDeletes a service principal from the Databricks account by its internal ID.
resolveexecaccount_id, external_idResolves an SP with the given external ID from the customer's IdP. If the SP does not exist, it will

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstring
internal_idstringRequired. Internal ID of the service principal in Databricks.
update_maskstringOptional. The list of fields to update.
filterstringOptional. Allows filtering service principals by application id or external id.
page_sizeintegerThe maximum number of service principals to return. The service may return fewer than this value.
page_tokenstringA page token, received from a previous ListServicePrincipals call. Provide this to retrieve the subsequent page.

SELECT examples

Fetches a service principal from the Databricks account by its internal ID.

SELECT
account_id,
application_id,
external_id,
internal_id,
display_name,
account_sp_status
FROM databricks_account.iamv2.service_principals
WHERE account_id = '{{ account_id }}' -- required
AND internal_id = '{{ internal_id }}' -- required
;

INSERT examples

Creates a service principal in the Databricks account and returns the resulting ServicePrincipal

INSERT INTO databricks_account.iamv2.service_principals (
service_principal,
account_id
)
SELECT
'{{ service_principal }}' /* required */,
'{{ account_id }}'
RETURNING
account_id,
application_id,
external_id,
internal_id,
display_name,
account_sp_status
;

UPDATE examples

Updates an existing service principal in the Databricks account. Only the fields named in the update

UPDATE databricks_account.iamv2.service_principals
SET
service_principal = '{{ service_principal }}'
WHERE
account_id = '{{ account_id }}' --required
AND internal_id = '{{ internal_id }}' --required
AND update_mask = '{{ update_mask }}' --required
AND service_principal = '{{ service_principal }}' --required
RETURNING
account_id,
application_id,
external_id,
internal_id,
display_name,
account_sp_status;

DELETE examples

Deletes a service principal from the Databricks account by its internal ID.

DELETE FROM databricks_account.iamv2.service_principals
WHERE account_id = '{{ account_id }}' --required
AND internal_id = '{{ internal_id }}' --required
;

Lifecycle Methods

Resolves an SP with the given external ID from the customer's IdP. If the SP does not exist, it will

EXEC databricks_account.iamv2.service_principals.resolve
@account_id='{{ account_id }}' --required
@@json=
'{
"external_id": "{{ external_id }}"
}'
;