Skip to main content

service_principals_v2

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

Overview

Nameservice_principals_v2
TypeResource
Iddatabricks_workspace.iam.service_principals_v2

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringDatabricks service principal ID.
activeboolean
applicationIdstringUUID relating to the service principal
displayNamestringString that represents a concatenation of given and family names.
entitlementsarrayEntitlements assigned to the service principal. See [assigning entitlements] for a full list of supported values. [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements
externalIdstring
groupsarray
rolesarrayCorresponds to AWS instance profile/arn role.
schemasarrayThe schema of the List response.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, deployment_nameGets the details for a single service principal define in the Databricks workspace.
listselectdeployment_nameattributes, count, excluded_attributes, filter, sort_by, sort_order, start_indexGets the set of service principals associated with a Databricks workspace.
createinsertdeployment_nameCreates a new service principal in the Databricks workspace.
patchupdateid, deployment_namePartially updates the details of a single service principal in the Databricks workspace.
replacereplaceid, deployment_nameUpdates the details of a single service principal.
deletedeleteid, deployment_nameDelete a single service principal in the Databricks workspace.

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)
idstringUnique ID for a service principal in the Databricks workspace.
attributesstringComma-separated list of attributes to return in response.
countintegerDesired number of results per page.
excluded_attributesstringComma-separated list of attributes to exclude in response.
filterstringQuery by which the results have to be filtered. Supported operators are equals(eq), contains(co), starts with(sw) and not equals(ne). Additionally, simple expressions can be formed using logical operators - and and or. The [SCIM RFC] has more details but we currently only support simple expressions. [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2
sort_bystringAttribute to sort the results.
sort_orderstringThe order to sort the results.
start_indexintegerSpecifies the index of the first result. First item is number 1.

SELECT examples

Gets the details for a single service principal define in the Databricks workspace.

SELECT
id,
active,
applicationId,
displayName,
entitlements,
externalId,
groups,
roles,
schemas
FROM databricks_workspace.iam.service_principals_v2
WHERE id = '{{ id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Creates a new service principal in the Databricks workspace.

INSERT INTO databricks_workspace.iam.service_principals_v2 (
active,
application_id,
display_name,
entitlements,
external_id,
groups,
id,
roles,
schemas,
deployment_name
)
SELECT
{{ active }},
'{{ application_id }}',
'{{ display_name }}',
'{{ entitlements }}',
'{{ external_id }}',
'{{ groups }}',
'{{ id }}',
'{{ roles }}',
'{{ schemas }}',
'{{ deployment_name }}'
RETURNING
id,
active,
applicationId,
displayName,
entitlements,
externalId,
groups,
roles,
schemas
;

UPDATE examples

Partially updates the details of a single service principal in the Databricks workspace.

UPDATE databricks_workspace.iam.service_principals_v2
SET
operations = '{{ operations }}',
schemas = '{{ schemas }}'
WHERE
id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required;

REPLACE examples

Updates the details of a single service principal.

REPLACE databricks_workspace.iam.service_principals_v2
SET
active = {{ active }},
application_id = '{{ application_id }}',
display_name = '{{ display_name }}',
entitlements = '{{ entitlements }}',
external_id = '{{ external_id }}',
groups = '{{ groups }}',
roles = '{{ roles }}',
schemas = '{{ schemas }}'
WHERE
id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required;

DELETE examples

Delete a single service principal in the Databricks workspace.

DELETE FROM databricks_workspace.iam.service_principals_v2
WHERE id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;