Global init scripts
Important
Databricks recommends configuring all init scripts as cluster-scoped init scripts and managing them across your workspace using cluster policies. See Cluster-scoped init scripts.
A global init script runs on all clusters in your workspace configured with single user or legacy no-isolation shared access mode. Only workpace admins can create global init scripts. You can create them using either the UI or REST API.
Important
Before using global init scripts, consider the following:
Global init scripts do not run on all cluster types. Only single user and no-isolation shared access modes are supported.
It is easy to add libraries or make other modifications that cause unexpected impacts. Whenever possible, use cluster-scoped init scripts instead.
Any user who creates a cluster and enables cluster log delivery can view the
stderr
andstdout
output from global init scripts. You should ensure that your global init scripts do not output any sensitive information.
You can troubleshoot global init scripts by configuring cluster log delivery and examining the init script log. See Init script logging.
Note
Global init scripts are not run on model serving clusters.
Note
To manage global init scripts, you must use the Global Init Scripts API.
Add a global init script using the UI
To configure global init scripts using the admin settings:
Go to the admin settings and click the Compute tab.
Click Manage next to Global init scripts.
Click + Add.
Name the script and enter it by typing, pasting, or dragging a text file into the Script field.
Note
The init script cannot be larger than 64KB. If a script exceeds that size, an error message appears when you try to save.
If you have more than one global init script configured for your workspace, set the order in which the new script will run.
If you want the script to be enabled for all new and restarted clusters after you save, toggle Enabled.
Important
When you add a global init script or make changes to the name, run order, or enablement of init scripts, those changes do not take effect until you restart the cluster.
Click Add.
Add a global init script using Terraform
You can add a global init script by using the Databricks Terraform provider and databricks_global_init_script.
Edit a global init script using the UI
Go to the admin settings and click the Compute tab.
Click Manage next to Global init scripts.
Click a script.
Edit the script.
Click Confirm.
Configure a global init script using the API
Workspace admins can add, delete, re-order, and get information about the global init scripts in your workspace using the Global Init Scripts API.