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. Set at creation time and cannot be changed afterwards; when omitted, the server generates one.
external_idstringExternalId of the service principal in the customer's IdP.
service_principal_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, service_principal_id, account_hostFetches a service principal from the Databricks account by its internal ID.
listselectaccount_id, account_hostfilter, page_size, page_tokenLists the service principals in the Databricks account, returning one page per call. Supports
createinsertaccount_id, account_host, display_name, account_sp_statusCreates a local service principal in the Databricks account and returns the created service principal.
updateupdateaccount_id, service_principal_id, update_mask, account_host, display_name, account_sp_statusUpdates an existing service principal in the Databricks account. Only the fields named in the update
deletedeleteaccount_id, service_principal_id, account_hostDeletes a service principal from the Databricks account by its internal ID.
resolveexecaccount_id, account_host, external_idResolves a service principal with the given external ID from the customer's IdP. If the service

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_hoststringThe Databricks account console host. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws), or set explicitly with DATABRICKS_ACCOUNT_HOST (bare host, no scheme). (default: accounts.cloud.databricks.com, x-stackQL-envVar: DATABRICKS_ACCOUNT_HOST, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"accounts.cloud.databricks.com","azure":"accounts.azuredatabricks.net","gcp":"accounts.gcp.databricks.com"}})
account_idstring
service_principal_idstringRequired. Internal ID of the service principal in Databricks.
update_maskstringRequired. 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. If not provided, defaults to 1000, which is also the maximum allowed. Requests for more than the maximum are clamped to 1000.
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,
service_principal_id,
display_name,
account_sp_status
FROM databricks_account.iamv2.service_principals
WHERE account_id = '{{ account_id }}' -- required
AND service_principal_id = '{{ service_principal_id }}' -- required
AND account_host = '{{ account_host }}' -- required
;

INSERT examples​

Creates a local service principal in the Databricks account and returns the created service principal.

INSERT INTO databricks_account.iamv2.service_principals (
display_name,
account_sp_status,
account_id,
application_id,
external_id,
service_principal_id,
account_id,
account_host
)
SELECT
'{{ display_name }}' /* required */,
'{{ account_sp_status }}' /* required */,
'{{ account_id }}',
'{{ application_id }}',
'{{ external_id }}',
'{{ service_principal_id }}',
'{{ account_id }}',
'{{ account_host }}'
RETURNING
account_id,
application_id,
external_id,
service_principal_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
display_name = '{{ display_name }}',
account_sp_status = '{{ account_sp_status }}',
account_id = '{{ account_id }}',
application_id = '{{ application_id }}',
external_id = '{{ external_id }}',
service_principal_id = '{{ service_principal_id }}'
WHERE
account_id = '{{ account_id }}' --required
AND service_principal_id = '{{ service_principal_id }}' --required
AND update_mask = '{{ update_mask }}' --required
AND account_host = '{{ account_host }}' --required
AND display_name = '{{ display_name }}' --required
AND account_sp_status = '{{ account_sp_status }}' --required
RETURNING
account_id,
application_id,
external_id,
service_principal_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 service_principal_id = '{{ service_principal_id }}' --required
AND account_host = '{{ account_host }}' --required
;

Lifecycle Methods​

Resolves a service principal with the given external ID from the customer's IdP. If the service

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