Skip to main content

vw_service_principal_roles

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

Overview

Namevw_service_principal_roles
TypeView
Iddatabricks_workspace.iam.vw_service_principal_roles

Fields

The following fields are returned by this view:

NameDatatypeDescription
deployment_namestringWorkspace deployment name used to scope the query.
idstringUnique identifier for the service principal.
displayNamestringHuman-readable display name of the service principal.
applicationIdintegerApplication ID of the service principal.
activebooleanWhether the service principal is active.
rolestringRole assigned to the service principal (one row per role assignment).

Required Parameters

The following parameters are required by this view:

NameDatatypeDescription
deployment_namestringWorkspace deployment name used to scope the query.

SELECT Examples

SELECT
deployment_name,
id,
displayName,
applicationId,
active,
role
FROM databricks_workspace.iam.vw_service_principal_roles
WHERE deployment_name = '{{ deployment_name }}';

SQL Definition

SELECT
sp.deployment_name,
sp.id,
sp.displayName,
sp.applicationId,
sp.active,
JSON_EXTRACT(r.value, '$.value') AS role
FROM databricks_workspace.iam.service_principals_v2 sp,
JSON_EACH(sp.roles) r
WHERE sp.deployment_name = '{{ deployment_name }}'