Databricks Asset Bundles (DABs) provide a way to define Databricks assets — jobs, DLT pipelines, notebooks, ML models, and more — as code, and deploy them consistently across multiple environments (dev / staging / prod). You describe asset configuration in a databricks.yml file, and use the Databricks CLI bundle commands to validate, deploy, run, and destroy them.
This article walks through the core concepts of DABs, the databricks.yml structure, per-environment targets, the main CLI commands, and how to choose between DABs, Terraform, and Repos.
DABs are the tool that brings "Infrastructure as Code (IaC) + Application as Code" to Databricks. Historically, Databricks development meant creating jobs and pipelines manually in the UI, and copying them by hand when moving between environments (dev → staging → prod). DABs let you define those same assets in YAML, manage them in Git, and deploy them automatically through CI/CD.
DABs can manage the following kinds of assets:
The databricks.yml placed at the project root is built from the following main sections:
bundle:
name: my-etl-pipeline
variables:
catalog_name:
description: "Target catalog"
default: "dev_catalog"
warehouse_id:
description: "SQL Warehouse ID"
workspace:
root_path: /Workspace/Users/${workspace.current_user.userName}/.bundle/${bundle.name}/${bundle.target}
resources:
jobs:
daily_etl:
name: "daily-etl-${bundle.target}"
schedule:
quartz_cron_expression: "0 0 2 * * ?"
timezone_id: "Asia/Tokyo"
tasks:
- task_key: ingest
notebook_task:
notebook_path: ./src/ingest.py
new_cluster:
spark_version: "14.3.x-scala2.12"
num_workers: 4
node_type_id: "i3.xlarge"
- task_key: transform
depends_on:
- task_key: ingest
notebook_task:
notebook_path: ./src/transform.py
new_cluster:
spark_version: "14.3.x-scala2.12"
num_workers: 8
pipelines:
dlt_pipeline:
name: "dlt-pipeline-${bundle.target}"
target: "${var.catalog_name}.bronze"
libraries:
- notebook:
path: ./src/dlt_definitions.py
targets:
dev:
mode: development
default: true
variables:
catalog_name: "dev_catalog"
staging:
variables:
catalog_name: "staging_catalog"
prod:
mode: production
variables:
catalog_name: "prod_catalog"
run_as:
service_principal_name: "prod-deployer-sp"The targets section is how you deploy the same asset definitions to different environments. Each target can override variables, permissions, and the run-as identity (run_as).
| Target attribute | Description | Example dev value | Example prod value |
|---|---|---|---|
| mode | development / production | development (name prefixing, restricted permissions) | production (run_as required, production permissions) |
| variables | Environment-specific variable values | catalog_name: dev_catalog | catalog_name: prod_catalog |
| run_as | Identity that runs the assets | Omitted (deploying user) | service_principal_name specified |
| workspace.host | Target workspace URL | dev-workspace.cloud.databricks.com | prod-workspace.cloud.databricks.com |
| default | Whether this is the default target | true | Omitted (false) |
In development mode, resource names are automatically prefixed with [dev username], so multiple developers can deploy bundles to the same workspace without name collisions. In production mode, run_as is required, and using a service principal is the recommended best practice.
| Command | Description | Typical use |
|---|---|---|
| databricks bundle validate | Syntax and reference checks against databricks.yml | CI/CD PR checks, local validation |
| databricks bundle deploy -t dev | Deploy assets to the specified target | Create or update jobs and DLT pipelines |
| databricks bundle run -t dev daily_etl | Run a deployed job immediately | Smoke testing, manual triggers |
| databricks bundle destroy -t dev | Remove every deployed asset | Cleaning up validation environments |
| databricks bundle summary | Show a summary of what will be deployed | Final review before deploying |
Declare variables inside databricks.yml. Override their defaults per target, or inject values at CLI runtime via the --var flag.
# Inject variables at CLI runtime
databricks bundle deploy -t prod --var="catalog_name=prod_catalog"
# Example in a CI/CD pipeline (GitHub Actions)
- name: Deploy to prod
run: |
databricks bundle deploy -t prod \
--var="catalog_name=${{ secrets.PROD_CATALOG }}" \
--var="warehouse_id=${{ secrets.PROD_WAREHOUSE_ID }}"Best practice: do not write secrets (passwords, API keys, etc.) into databricks.yml. Store them in a Databricks Secret Scope and read them inside notebooks via dbutils.secrets.get.
| Criterion | Databricks Asset Bundles | Terraform | Repos (Git integration) |
|---|---|---|---|
| Main targets | Jobs / DLT / notebooks / ML models | Workspaces / cluster policies / UC / networking | Version control of notebooks and Python files |
| Definition language | YAML (databricks.yml) | HCL (.tf) | Git-only (no declarative definitions) |
| Per-environment management | targets + variables | workspaces + tfvars | Branch-based (manual switching) |
| State management | Managed by the Databricks workspace | Managed via S3 / Azure Blob / Terraform Cloud | None (just Git history) |
| CI/CD integration | Databricks CLI + GitHub Actions / Azure DevOps | terraform plan/apply + a CI/CD tool | Git push → auto-sync |
| Deletion management | bundle destroy removes everything at once | terraform destroy removes everything at once | Manual deletion only |
| Learning curve | Low (YAML + Databricks CLI) | Medium-high (HCL plus state-management concepts) | Low (just Git operations) |
DABs show up on the Data Engineer Professional and administration-focused exams.
Data Engineer Professional
問題 1
A team builds Databricks ETL jobs and DLT pipelines in a development environment and wants to deploy them safely to production. In production, the jobs must run as a service principal and use a different catalog name. Which approach is best?
正解: B
DABs are purpose-built for deploying jobs and DLT pipelines across environments. You can switch the catalog name via variables in each target, and pin the identity with run_as. UI copying is error-prone, Terraform is aimed at the infrastructure layer (it can define jobs, but DABs is more specialised for Databricks assets), and Repos only handles version control — it does not include job definitions.
How should I choose between Databricks Asset Bundles (DABs) and Terraform?
DABs are purpose-built for distributing Databricks assets — jobs, pipelines, notebooks, ML models — and managing per-environment differences. Terraform, by contrast, is better suited to infrastructure-level resources such as workspaces, cluster policies, networking, and UC metastores. In practice, the recommended pattern is a two-layer setup: build the underlying infrastructure with Terraform, and manage the application assets running on top of it (jobs, DLT pipelines, ML models, etc.) with DABs.
Where do I define environment variables in databricks.yml?
Use the variables block inside the targets section to swap values per environment. For example, if you want to vary the catalog name or cluster size across dev/staging/prod, declare catalog_name in variables and override the default in each target. You can also inject values from the command line via the --var flag in CI/CD pipelines.
How do I completely remove assets deployed with DABs?
Use the databricks bundle destroy command. It removes every asset the bundle manages — jobs, DLT pipelines, deployed notebooks, and so on — from the workspace. Data produced by the jobs (Delta tables, for example) is not deleted. The --auto-approve flag skips the confirmation prompt, but manual confirmation is recommended in production.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Databricks Certifications: All 7 Exams, Difficulty & Study Plan (2026)
Complete guide to all 7 Databricks certifications — Data Eng...
Databricks Exam Difficulty Ranking: All 7 Certs Compared (2026)
Every Databricks certification ranked by difficulty, with st...
Databricks Study Guide: Fastest Pass Route & Time Estimates (2026)
How to pass Databricks certifications efficiently. Official ...
Databricks Data Engineer Associate: Complete Guide (2026)
Domain-by-domain breakdown of the Databricks Certified Data ...
Databricks Data Engineer Professional: Complete Guide (2026)
Tactics for the Databricks Certified Data Engineer Professio...