service_principals
Creates, updates, deletes, gets or lists a service_principals resource.
Overview​
| Name | service_principals |
| Type | Resource |
| Id | databricks_account.iamv2.service_principals |
Fields​
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
account_id | string | The parent account ID for the service principal in Databricks. |
application_id | string | Application ID of the service principal. Set at creation time and cannot be changed afterwards; when omitted, the server generates one. |
external_id | string | ExternalId of the service principal in the customer's IdP. |
service_principal_id | string | Internal service principal ID of the service principal in Databricks. |
display_name | string | Display name of the service principal. |
account_sp_status | string | The activity status of a service principal in a Databricks account. (ACTIVE, INACTIVE) |
| Name | Datatype | Description |
|---|---|---|
account_id | string | The parent account ID for the service principal in Databricks. |
application_id | string | Application ID of the service principal. Set at creation time and cannot be changed afterwards; when omitted, the server generates one. |
external_id | string | ExternalId of the service principal in the customer's IdP. |
service_principal_id | string | Internal service principal ID of the service principal in Databricks. |
display_name | string | Display name of the service principal. |
account_sp_status | string | The activity status of a service principal in a Databricks account. (ACTIVE, INACTIVE) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, service_principal_id, account_host | Fetches a service principal from the Databricks account by its internal ID. | |
list | select | account_id, account_host | filter, page_size, page_token | Lists the service principals in the Databricks account, returning one page per call. Supports |
create | insert | account_id, account_host, display_name, account_sp_status | Creates a local service principal in the Databricks account and returns the created service principal. | |
update | update | account_id, service_principal_id, update_mask, account_host, display_name, account_sp_status | Updates an existing service principal in the Databricks account. Only the fields named in the update | |
delete | delete | account_id, service_principal_id, account_host | Deletes a service principal from the Databricks account by its internal ID. | |
resolve | exec | account_id, account_host, external_id | Resolves 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.
| Name | Datatype | Description |
|---|---|---|
account_host | string | The 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_id | string | |
service_principal_id | string | Required. Internal ID of the service principal in Databricks. |
update_mask | string | Required. The list of fields to update. |
filter | string | Optional. Allows filtering service principals by application id or external id. |
page_size | integer | The 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_token | string | A page token, received from a previous ListServicePrincipals call. Provide this to retrieve the subsequent page. |
SELECT examples​
- get
- list
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
;
Lists the service principals in the Databricks account, returning one page per call. Supports
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 account_host = '{{ account_host }}' -- required
AND filter = '{{ filter }}'
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;
INSERT examples​
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: service_principals
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the service_principals resource.
- name: account_host
value: "{{ account_host }}"
description: Required parameter for the service_principals resource.
- name: display_name
value: "{{ display_name }}"
description: |
Display name of the service principal.
- name: account_sp_status
value: "{{ account_sp_status }}"
description: |
The activity status of a service principal in a Databricks account.
- name: account_id
value: "{{ account_id }}"
description: |
The parent account ID for the service principal in Databricks.
- name: application_id
value: "{{ application_id }}"
description: |
Application ID of the service principal. Set at creation time and cannot be changed afterwards; when omitted, the server generates one.
- name: external_id
value: "{{ external_id }}"
description: |
ExternalId of the service principal in the customer's IdP.
- name: service_principal_id
value: "{{ service_principal_id }}"
description: |
Internal service principal ID of the service principal in Databricks.
UPDATE examples​
- update
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​
- delete
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​
- resolve
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 }}"
}'
;