Skip to main content

storage_credentials

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

Overview

Namestorage_credentials
TypeResource
Iddatabricks_workspace.catalog.storage_credentials

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the credential.
namestringThe credential name. The name must be unique among storage and service credentials within the metastore.
metastore_idstringUnique identifier of the parent metastore.
full_namestringThe full name of the credential.
aws_iam_roleobjectThe AWS IAM role configuration
azure_managed_identityobjectThe Azure managed identity configuration.
azure_service_principalobjectThe Azure service principal configuration.
cloudflare_api_tokenobjectThe Cloudflare API token configuration.
commentstringComment associated with the credential.
created_atintegerTime at which this credential was created, in epoch milliseconds.
created_bystringUsername of credential creator.
databricks_gcp_service_accountobjectThe Databricks managed GCP service account configuration.
isolation_modestringCreate a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />&gt;&gt;&gt; class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />&gt;&gt;&gt; Color.RED<br />&lt;Color.RED: 1&gt;<br /><br />- value lookup:<br /><br />&gt;&gt;&gt; Color(1)<br />&lt;Color.RED: 1&gt;<br /><br />- name lookup:<br /><br />&gt;&gt;&gt; Color['RED']<br />&lt;Color.RED: 1&gt;<br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />&gt;&gt;&gt; len(Color)<br />3<br /><br />&gt;&gt;&gt; list(Color)<br />[&lt;Color.RED: 1&gt;, &lt;Color.BLUE: 2&gt;, &lt;Color.GREEN: 3&gt;]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (ISOLATION_MODE_ISOLATED, ISOLATION_MODE_OPEN)
ownerstringUsername of current owner of credential.
read_onlybooleanWhether the credential is usable only for read operations. Only applicable when purpose is **STORAGE**.
updated_atintegerTime at which this credential was last modified, in epoch milliseconds.
updated_bystringUsername of user who last modified the credential.
used_for_managed_storagebooleanWhether this credential is the current metastore's root storage credential. Only applicable when purpose is **STORAGE**.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, deployment_nameGets a storage credential from the metastore. The caller must be a metastore admin, the owner of the
listselectdeployment_nameinclude_unbound, max_results, page_tokenGets an array of storage credentials (as StorageCredentialInfo objects). The array is limited to
createinsertdeployment_name, nameCreates a new storage credential.
updateupdatename, deployment_nameUpdates a storage credential on the metastore.
deletedeletename, deployment_nameforceDeletes a storage credential from the metastore. The caller must be an owner of the storage
validateexecdeployment_nameValidates a storage credential. At least one of external_location_name and url need to be

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)
namestringName of the storage credential.
forcebooleanForce an update even if there are dependent external locations or external tables (when purpose is STORAGE) or dependent services (when purpose is SERVICE).
include_unboundbooleanWhether to include credentials not bound to the workspace. Effective only if the user has permission to update the credential–workspace binding.
max_resultsintegerMaximum number of storage credentials to return. If not set, all the storage credentials are returned (not recommended). - when set to a value greater than 0, the page length is the minimum of this value and a server configured value; - when set to 0, the page length is set to a server configured value (recommended); - when set to a value less than 0, an invalid parameter error is returned;
page_tokenstringOpaque pagination token to go to next page based on previous query.

SELECT examples

Gets a storage credential from the metastore. The caller must be a metastore admin, the owner of the

SELECT
id,
name,
metastore_id,
full_name,
aws_iam_role,
azure_managed_identity,
azure_service_principal,
cloudflare_api_token,
comment,
created_at,
created_by,
databricks_gcp_service_account,
isolation_mode,
owner,
read_only,
updated_at,
updated_by,
used_for_managed_storage
FROM databricks_workspace.catalog.storage_credentials
WHERE name = '{{ name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Creates a new storage credential.

INSERT INTO databricks_workspace.catalog.storage_credentials (
name,
aws_iam_role,
azure_managed_identity,
azure_service_principal,
cloudflare_api_token,
comment,
databricks_gcp_service_account,
read_only,
skip_validation,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ aws_iam_role }}',
'{{ azure_managed_identity }}',
'{{ azure_service_principal }}',
'{{ cloudflare_api_token }}',
'{{ comment }}',
'{{ databricks_gcp_service_account }}',
{{ read_only }},
{{ skip_validation }},
'{{ deployment_name }}'
RETURNING
id,
name,
metastore_id,
full_name,
aws_iam_role,
azure_managed_identity,
azure_service_principal,
cloudflare_api_token,
comment,
created_at,
created_by,
databricks_gcp_service_account,
isolation_mode,
owner,
read_only,
updated_at,
updated_by,
used_for_managed_storage
;

UPDATE examples

Updates a storage credential on the metastore.

UPDATE databricks_workspace.catalog.storage_credentials
SET
aws_iam_role = '{{ aws_iam_role }}',
azure_managed_identity = '{{ azure_managed_identity }}',
azure_service_principal = '{{ azure_service_principal }}',
cloudflare_api_token = '{{ cloudflare_api_token }}',
comment = '{{ comment }}',
databricks_gcp_service_account = '{{ databricks_gcp_service_account }}',
force = {{ force }},
isolation_mode = '{{ isolation_mode }}',
new_name = '{{ new_name }}',
owner = '{{ owner }}',
read_only = {{ read_only }},
skip_validation = {{ skip_validation }}
WHERE
name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
id,
name,
metastore_id,
full_name,
aws_iam_role,
azure_managed_identity,
azure_service_principal,
cloudflare_api_token,
comment,
created_at,
created_by,
databricks_gcp_service_account,
isolation_mode,
owner,
read_only,
updated_at,
updated_by,
used_for_managed_storage;

DELETE examples

Deletes a storage credential from the metastore. The caller must be an owner of the storage

DELETE FROM databricks_workspace.catalog.storage_credentials
WHERE name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND force = '{{ force }}'
;

Lifecycle Methods

Validates a storage credential. At least one of external_location_name and url need to be

EXEC databricks_workspace.catalog.storage_credentials.validate 
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"aws_iam_role": "{{ aws_iam_role }}",
"azure_managed_identity": "{{ azure_managed_identity }}",
"azure_service_principal": "{{ azure_service_principal }}",
"cloudflare_api_token": "{{ cloudflare_api_token }}",
"databricks_gcp_service_account": "{{ databricks_gcp_service_account }}",
"external_location_name": "{{ external_location_name }}",
"read_only": {{ read_only }},
"storage_credential_name": "{{ storage_credential_name }}",
"url": "{{ url }}"
}'
;