Skip to main content

Add resources to a Databricks app

Your Databricks apps can integrate with various Databricks platform features, such as Databricks SQL for querying data, Lakeflow Jobs for data ingestion and processing, Mosaic AI Model Serving to access generative AI models, and Databricks secrets for managing sensitive information. In the context of apps, these platform features are referred to as resources.

To keep apps portable and secure, avoid hardcoding resource IDs. For example, instead of embedding a fixed SQL warehouse ID in your app.yaml file, configure the SQL warehouse as a resource through the Databricks Apps UI or in databricks.yaml.

Apps run with least privilege and rely on existing resources within the Databricks platform. When deployed, the app’s service principal accesses these resources and must have the necessary permissions, such as table-level access for SQL queries or read access to secrets. See Configure authorization in a Databricks app.

Configure resources for your app

Resources allow your app to securely connect to services that it depends on, without hardcoding sensitive or environment-specific values.

Add most resources directly in the Apps UI when you create or edit your app.

In the App resources section, click + Add resource and select the resource type you want to use. You assign a key to each resource, which you reference in your app.yaml file.

Adding a SQL warehouse as an app resource in the UI

Next steps

After you add resources to your app, reference these resources in the env section of your app configuration using the valueFrom field. For instructions, see Define environment variables in a Databricks app.