What files can I reference in an init script?

The support for referencing other files in an init script depends on where the referenced files are stored. This article outlines this behavior and provides recommendations.

Databricks recommends managing all init scripts as cluster-scoped init scripts.

What identity is used to run init scripts?

In single user access mode, the identity of the assigned principal (a user or service principal) is used.

In shared access mode or no-isolation shared access mode, init scripts use the identity of the cluster owner.

Not all locations for storing init scripts are supported on all Databricks Runtime versions and access modes. See Where can init scripts be installed?.

Can I reference files in Unity Catalog volumes from init scripts?

You can reference libraries and init scripts stored in Unity Catalog volumes from init scripts stored in Unity Catalog volumes.

Important

Credentials required to access other files stored in Unity Catalog volumes are only made available within init scripts stored in Unity Catalog volumes. You cannot reference any files in Unity Catalog volumes from init scripts configured from other locations.

For clusters with shared access mode, only the configured init script needs to be added to the allowlist. Access to other files referenced in the init script is governed by Unity Catalog.

Can I reference workspace files from init scripts?

You cannot reference libraries, configuration files, or shell scripts stored in workspace files from init scripts. This includes libraries, shell scripts, or other files stored in Databricks Git folders.

Can I reference files in cloud object storage from init scripts?

You can reference libraries and init scripts stored in cloud object storage from init scripts.

For clusters with shared access mode, only the configured init script needs to be added to the allowlist. Access to other files referenced in the init script is determined by access configured to cloud object storage.

Databricks recommends using Google Cloud service accounts to manage access to libraries and init scripts stored in GCS. Create a Google Cloud service account with the Storage Object Viewer role for your desired bucket and attach it to a cluster. See Access GCS buckets using Google Cloud service accounts on clusters.