workspace_assignment
Creates, updates, deletes, gets or lists a workspace_assignment resource.
Overview
| Name | workspace_assignment |
| Type | Resource |
| Id | databricks_account.iam.workspace_assignment |
Fields
The following fields are returned by SELECT queries:
- workspace_assignment_list
| Name | Datatype | Description |
|---|---|---|
error | string | Error response associated with a workspace permission assignment, if any. |
permissions | array | The permissions level of the principal. |
principal | object | Information about the principal assigned to the workspace. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
workspace_assignment_list | select | account_id, workspace_id | Get the permission assignments for the specified Databricks account and Databricks workspace. | |
workspace_assignment_update | replace | account_id, workspace_id, principal_id | Creates or updates the workspace permissions assignment in a given account and workspace for the | |
workspace_assignment_delete | delete | account_id, workspace_id, principal_id | Deletes the workspace permissions assignment in a given account and workspace for the specified |
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.
| Name | Datatype | Description |
|---|---|---|
account_id | string | |
principal_id | integer | The ID of the user, service principal, or group. |
workspace_id | integer | The workspace ID for the account. |
SELECT examples
- workspace_assignment_list
- Workspaces with assignments
Get the permission assignments for the specified Databricks account and Databricks workspace.
SELECT
error,
permissions,
principal
FROM databricks_account.iam.workspace_assignment
WHERE account_id = '{{ account_id }}' -- required
AND workspace_id = '{{ workspace_id }}' -- required
;
Join workspaces with their principal assignments:
SELECT
w.workspace_id,
w.workspace_name,
w.workspace_status,
JSON_EXTRACT(wa.principal, '$.display_name') as display_name,
JSON_EXTRACT(wa.principal, '$.principal_id') as principal_id,
JSON_EXTRACT(wa.principal, '$.service_principal_name') as service_principal_name,
wa.permissions,
wa.error
FROM databricks_account.provisioning.workspaces w
LEFT JOIN databricks_account.iam.workspace_assignment wa
ON w.workspace_id = wa.workspace_id
WHERE account_id = '{{ account_id }}';
REPLACE examples
- workspace_assignment_update
Creates or updates the workspace permissions assignment in a given account and workspace for the
REPLACE databricks_account.iam.workspace_assignment
SET
permissions = '{{ permissions }}'
WHERE
account_id = '{{ account_id }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND principal_id = '{{ principal_id }}' --required
RETURNING
error,
permissions,
principal;
DELETE examples
- workspace_assignment_delete
Deletes the workspace permissions assignment in a given account and workspace for the specified
DELETE FROM databricks_account.iam.workspace_assignment
WHERE account_id = '{{ account_id }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND principal_id = '{{ principal_id }}' --required
;