vw_service_principal_roles
Creates, updates, deletes, gets or lists a vw_service_principal_roles resource.
Overview
| Name | vw_service_principal_roles |
| Type | View |
| Id | databricks_workspace.iam.vw_service_principal_roles |
Fields
The following fields are returned by this view:
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | Workspace deployment name used to scope the query. |
id | string | Unique identifier for the service principal. |
displayName | string | Human-readable display name of the service principal. |
applicationId | integer | Application ID of the service principal. |
active | boolean | Whether the service principal is active. |
role | string | Role assigned to the service principal (one row per role assignment). |
Required Parameters
The following parameters are required by this view:
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | Workspace 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
- Sqlite3
- Postgres
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 }}'
SELECT
sp.deployment_name,
sp.id,
sp.displayName,
sp.applicationId,
sp.active,
r.value->>'value' AS role
FROM databricks_workspace.iam.service_principals_v2 sp,
jsonb_array_elements(sp.roles::jsonb) AS r
WHERE sp.deployment_name = '{{ deployment_name }}'