Skip to main content

service_principals

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

Overview

Nameservice_principals
TypeResource
Iddatabricks_workspace.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
getselectinternal_id, deployment_nameFetches a service principal by its internal ID from the Databricks account that parents the calling
listselectdeployment_namefilter, page_size, page_tokenLists the service principals in the Databricks account that parents the calling workspace, returning
createinsertdeployment_name, service_principalCreates a service principal in the Databricks account that parents the calling workspace and returns
updateupdateinternal_id, update_mask, deployment_name, service_principalUpdates an existing service principal in the Databricks account that parents the calling workspace.
deletedeleteinternal_id, deployment_nameDeletes a service principal by its internal ID from the Databricks account that parents the calling
resolveexecdeployment_name, 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
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
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 SPs 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 by its internal ID from the Databricks account that parents the calling

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

INSERT examples

Creates a service principal in the Databricks account that parents the calling workspace and returns

INSERT INTO databricks_workspace.iamv2.service_principals (
service_principal,
deployment_name
)
SELECT
'{{ service_principal }}' /* required */,
'{{ deployment_name }}'
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 that parents the calling workspace.

UPDATE databricks_workspace.iamv2.service_principals
SET
service_principal = '{{ service_principal }}'
WHERE
internal_id = '{{ internal_id }}' --required
AND update_mask = '{{ update_mask }}' --required
AND deployment_name = '{{ deployment_name }}' --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 by its internal ID from the Databricks account that parents the calling

DELETE FROM databricks_workspace.iamv2.service_principals
WHERE internal_id = '{{ internal_id }}' --required
AND deployment_name = '{{ deployment_name }}' --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_workspace.iamv2.service_principals.resolve
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"external_id": "{{ external_id }}"
}'
;