CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 8 · Lesson 42/45

    Deploying with Declarative Automation Bundles: databricks.yml, targets, variables and modes

    Deploy Databricks resources using Declarative Automation Bundles (formerly Databricks Asset Bundles).

    21 min read
    2.5% of exam
    9 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Read a databricks.yml and name the bundle, resources, variables and targets it defines
    • Predict which target a bundle command deploys to when -t is omitted, and how target settings override top-level resources
    • Resolve a bundle variable's value using the CLI's five-step lookup order, including BUNDLE_VAR_ environment variables
    • Tell apart the behaviours of development mode, production mode and presets
    • Choose the right bundle command (validate, deploy, run, destroy) and explain how deployment state and root_path decide which workspace objects a deploy touches
    • Declare wheel, PyPI and environment dependencies inside bundle job resources so that deployed runs install them reproducibly

    Key concept

    Bundle deployment to a target — A bundle is a YAML description of a project's Databricks resources and source files. The CLI deploys it as one unit to a named target, and each target can change the workspace, variables, mode or resources for that environment.

    1.What a bundle is and where its configuration lives

    Declarative Automation Bundles, formerly Databricks Asset Bundles, let you manage Databricks projects as infrastructure as code. Jobs, Lakeflow pipelines, dashboards, schemas, volumes and other workspace objects are described in YAML that sits next to the notebooks and Python files they run. Because that YAML lives in source control, a job definition goes through the same review, testing and CI/CD as the code it runs. Bundles suit team projects where several people contribute and deployments are automated. A one-off job built by one person in the UI gains little from them.

    **Every bundle has exactly one databricks.yml at the project root.** That file must name the bundle under the required bundle mapping, and it usually declares at least one target. It can pull in other YAML files through include, so a large project can keep each job in its own file and the targets in another. The CLI merges all of them into one configuration. The smallest valid bundle needs only a name and a target:

    The minimal databricks.yml: a required bundle name and one default targetyaml
    bundle:
      name: my_bundle
    
    targets:
      dev:
        default: true

    **Resources are declared under the resources mapping, keyed by type and then by a unique key you choose**: jobs, pipelines, schemas, volumes, dashboards and so on. A resource's keys are the create-request fields of its REST API object written as YAML. A job resource therefore takes the same tasks, notebook_task and existing_cluster_id fields the Jobs API accepts. Other top-level mappings include variables for values that change between environments, run_as and permissions for identities, artifacts for things the CLI builds (such as wheels), sync for which files to upload, and workspace for host and path settings. You don't have to write all of this by hand. databricks bundle init creates a project from a template, and databricks bundle generate writes YAML for a job or pipeline that already exists in the workspace.

    Checkpoint 1 of 9· Fill the gap

    This is the smallest valid databricks.yml: a required bundle name and one target that the CLI uses when no target is given. Which key completes it?

    bundle:
      name: my_bundle
    
    targets:
      dev:
         ? : true

    Sources123

    2.Targets: one bundle, several environments

    **A target is a named environment, such as dev, staging or prod, that can override any top-level setting.** Top-level resources, workspace, variables and artifacts act as defaults. Each entry under targets changes only what differs for that environment. In the example below, prod points at a different workspace host and swaps in a different cluster ID for the task. It never restates the notebook_task, because anything a target leaves out falls back to the top-level definition.

    A prod target that changes the workspace host and the task's cluster, inheriting everything elseyaml
    targets:
      dev:
        default: true
      prod:
        workspace:
          host: https://<production-workspace-url>
        resources:
          jobs:
            hello-job:
              name: hello-job
              tasks:
                - task_key: hello-task
                  existing_cluster_id: 2345-678901-fabcd456

    **The -t (or --target) flag picks the target. Leaving it out sends the command to the single target marked default: true.** Only one target may be the default. The CLI does not deploy to every target, does not prefer the last one listed, and does not fail just because several targets exist. To deploy anywhere other than the default, name the target explicitly:

    Deploying to a non-default target requires -t on every commandbash
    # You must specify "-t prod", because the "dev" target
    # is already set to "default: true":
    databricks bundle validate
    databricks bundle deploy -t prod
    databricks bundle run -t prod hello_job

    Prefer workspace.host in each target over hard-coding a CLI profile. Given a host, the CLI finds the matching profile in .databrickscfg and uses that profile's authentication, so the same bundle works on any machine that has credentials for the host. You only need --profile if several profiles share the same host. Note that --profile (-p) selects authentication and has nothing to do with bundle variables.

    Checkpoint 2 of 9· Check yourself

    Top-level resources define hello-job with a notebook_task (./hello.py) on cluster 1234-567890-abcde123. The prod target sets a different workspace host and gives hello-task only existing_cluster_id 2345-678901-fabcd456. After databricks bundle deploy -t prod, what does the prod job run?

    Checkpoint 3 of 9· Exam question

    A platform team maintains a Declarative Automation Bundle with the following databricks.yml targets block: targets: dev: default: true workspace: host: https://dev-workspace.cloud.databricks.com prod: workspace: host: https://prod-workspace.cloud.databricks.com An engineer runs databricks bundle deploy from the repository root without passing a -t flag. Which target receives the deployment?

    Sources14

    3.Custom variables and how the CLI resolves them

    Custom variables put values that change between environments, such as warehouse IDs, catalog names and schema names, in one place. You declare each variable under the top-level variables mapping with a description and an optional default, and you reference it anywhere as ${var.<name>}. A target can give a variable a different value under its own variables mapping. Variables are strings unless you set type: complex, which is the only valid value for type. With it, a variable can hold a structure such as a full cluster definition.

    The CLI checks five places in a fixed order and stops at the first value it finds. The order explains a common CI pattern. A pipeline that needs a different value on every run can export BUNDLE_VAR_<name> before calling databricks bundle deploy. It doesn't have to edit databricks.yml or commit an override file, and the environment variable beats both the target's mapping and the declared default.

    Variable resolution order, highest priority first
    OrderWhere the value comes fromTypical use
    1--var options on the bundle commandOne-off override typed at the terminal
    2Environment variables beginning with BUNDLE_VAR_CI runners setting a per-run value without touching files
    3The variable-overrides.json file, if it existsLocal overrides kept outside the main YAML
    4The variables mapping inside the selected targetFixed per-environment values, such as prod_catalog in prod
    5The default in the top-level variables definitionFallback when nothing else sets the variable

    Checkpoint 4 of 9· Check yourself

    A team wants one bundle variable, referenced as ${var.job_cluster}, to hold a full cluster definition with node type, worker count and Spark config, and to change it per target. How must the variable be declared?

    Checkpoint 5 of 9· Exam question

    A bundle defines: variables: warehouse_id: description: SQL warehouse used by the nightly job default: abc123 and a job task references ${var.warehouse_id}. A CI pipeline needs to deploy to a staging target using a different warehouse ID on every run, without editing databricks.yml or committing a target-specific override file. Which approach satisfies this requirement?

    Sources5

    4.Development mode, production mode and presets

    **Setting mode on a target applies a group of common behaviours in one line.** Modes are optional, and a target with no mode deploys exactly what its configuration says. The two modes protect against opposite risks. Development mode keeps several engineers' copies from colliding and stops test jobs from firing on their own. Production mode refuses deployments that look like they came from the wrong place.

    A target with mode: development does the following on deploy:

    • Prefixes every resource that is not a file or notebook with [dev ${workspace.current_user.short_name}], and tags each job and pipeline with a dev tag
    • Marks every deployed Lakeflow pipeline development: true
    • Pauses all schedules and triggers, so a nightly job does not start running from someone's laptop
    • Allows concurrent runs on all jobs, so test runs can overlap
    • Disables the deployment lock to speed up iteration
    • Accepts --cluster-id (or a cluster_id mapping) to replace every cluster definition with one interactive cluster

    A target with mode: production checks the deployment instead of relaxing it:

    • Checks that every deployed Lakeflow pipeline is development: false
    • Checks that the current Git branch matches the target's git.branch, if one is set. --force overrides this check
    • Refuses cluster overrides, so the clusters defined in configuration are the ones that run
    • If no service principal is used, checks that paths such as root_path are not overridden to a specific user, and that run_as and permissions are set

    Databricks recommends a service principal as the run_as identity for production. Production mode encourages this through the checks above but doesn't strictly require it.

    Which mode a behaviour belongs to
    Behaviourdevelopmentproduction
    [dev <short_name>] name prefixAppliedNot applied
    Pipelines' development flagSet to trueValidated as false
    Schedules and triggersPausedLeft as configured
    Git branch must match targetNo checkValidated (override with --force)
    --cluster-id overrideAllowedNot allowed
    Deployment lockDisabledEnabled

    Presets let you adjust individual mode behaviours. Settings follow a three-level order: presets override the mode's defaults, and a setting on an individual resource overrides the preset. Suppose a job sets max_concurrent_runs: 10 and the jobs_max_concurrent_runs preset is 20. The job gets 10. Likewise, a schedule explicitly set to UNPAUSED stays unpaused even under a trigger_pause_status: PAUSED preset.

    Presets for a dev target: custom name prefix, pipeline development flag, paused triggers, concurrency and tagsyaml
    targets:
      dev:
        presets:
          name_prefix: 'testing_' # prefix all resource names with testing_
          pipelines_development: true # set development to true for pipelines
          trigger_pause_status: PAUSED # set pause_status to PAUSED for all triggers and schedules
          jobs_max_concurrent_runs: 10 # set max_concurrent runs to 10 for all jobs
          tags:
            department: finance

    Checkpoint 6 of 9· Match them up

    Match each target setting to what it does when you run databricks bundle deploy.

    Tap a term, then the definition that fits it.

    Checkpoint 7 of 9· Exam question

    A data engineer deploys a bundle to a target configured with mode: development and no presets overrides. Reviewing the deployed workspace objects afterward, which behaviors should the engineer expect to see applied automatically? (Select all that apply.)(Select 3)

    0 of 3 selected

    Sources6

    5.Validate, deploy, run, destroy, and what a deploy actually changes

    A bundle goes through four commands, each taking -t to choose the target:

    1. databricks bundle validate checks the configuration and prints a summary of the bundle name, target and workspace. It warns about unknown resource properties, so a mistyped field shows up here rather than being silently ignored.
    2. databricks bundle deploy uploads files and builds artifacts, then creates or updates the target's resources.
    3. databricks bundle run <key> starts a deployed job or pipeline, identified by its resource key from the YAML rather than its display name.
    4. databricks bundle destroy permanently deletes the jobs, pipelines and artifacts the bundle previously deployed. This cannot be undone.

    A deployment matches resources by ID, not by name. The bundle stores the IDs of the resources it created as state in the workspace file system. On each deploy, a resource in the configuration that does not yet exist is created, one that exists is updated, and one removed from the configuration is deleted from the workspace if this bundle deployed it. Changing a job's name field therefore updates the same job, and deleting a job's YAML block deletes the job on the next deploy. To bring a job created in the UI under bundle control without recreating it, use databricks bundle deployment bind with the job's ID.

    **root_path determines a deployment's identity.** It defaults to ~/.bundle/${bundle.name}/${bundle.target}, which combines the deployer, the bundle name and the target. Two engineers who deploy the same bundle to dev therefore get separate copies. Two different bundles that share a name and target, deployed by the same identity, will interfere with each other. A bundle only forgets a resource if you change the bundle name, the target or the workspace.

    Other deploy flags: --fail-on-active-runs aborts if jobs or pipelines in the deployment are running. --auto-approve skips interactive prompts, which non-interactive CI needs. --select my_job deploys only the named resources and their upstream dependencies. That is handy in a dev workspace, but downstream resources are not updated, which is why it is not meant for production.

    Checkpoint 8 of 9· Match them up

    A team changes the YAML of a bundle that is already deployed and runs databricks bundle deploy -t dev again. Pair each change with what happens in the workspace.

    Tap a term, then the definition that fits it.

    Sources374

    6.Declaring libraries and environments in bundle resources

    Notebook %pip, compute libraries and serverless environment dependencies each install packages at a different scope, as covered in library installation scopes (notebook %pip, compute/task libraries, environment dependencies). In a bundle, you declare those dependencies in the job or pipeline resource definition. Every deploy then writes the same library list into the workspace resource, so every run installs the same set without relying on someone attaching packages by hand.

    Bundles support three kinds of library dependency:

    • Python wheel files
    • JAR files for Java or Scala
    • PyPI, Maven or CRAN packages

    For Python, you can also list dependencies in a pyproject.toml included in the bundle. To attach a wheel to a job task, add a libraries list to the task with one whl entry per wheel. The wheel can come from workspace files, a Unity Catalog volume, cloud object storage or a local path. A local wheel is built and uploaded as part of the deploy. Whether a particular library works still depends on the cluster configuration and where the library comes from.

    Serverless jobs declare dependencies through an environment, not a cluster. A bundle job on serverless compute can either omit the cluster settings for a notebook task or reference an environment that holds the job's dependencies. Changing a library version is then a one-line change in the YAML: it is reviewed like code, deployed per target, and rolled back by reverting the commit.

    Checkpoint 9 of 9· Check yourself

    An engineer changes the wheel version in the libraries list of a job task in the top-level resources and runs databricks bundle deploy -t staging. The job is already deployed to both staging and prod. What happens?

    Sources89

    Practise it for real

    Take a template bundle through its full lifecycle on a development target and watch what development mode changes in the workspace.

    1. 1.Run databricks bundle init and choose the default Python template, then open the generated databricks.yml.

      Why: The template produces a working databricks.yml with resources and targets to change.

      You should see: A project folder with databricks.yml at its root, a job definition and a notebook.

    2. 2.Run databricks bundle validate.

      Why: Validation catches configuration mistakes before anything reaches the workspace.

      You should see: A summary of the bundle name, target and workspace, with warnings for any unknown resource property.

    3. 3.Run databricks bundle deploy -t dev against a target set to mode: development.

      Why: This shows what development mode does to deployed objects.

      You should see: The job appears in the workspace with a [dev] prefix followed by your short name, and any schedule paused.

    4. 4.Run databricks bundle run -t dev with the job's resource key.

      Why: Runs are started by the resource key from the YAML, not the display name.

      You should see: A run of the deployed job starts in the dev workspace.

    5. 5.Run databricks bundle destroy -t dev.

      Why: This removes everything the deployment created.

      You should see: The previously deployed job and its artifacts are permanently deleted.

    Stuck? Get a nudge

    If deploy reports a held lock after an interrupted attempt, --force-lock is only for that stale-lock situation.

    Sources

    (9)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “A bundle must contain one (and only one) configuration file named databricks.yml at the root of the bundle project folder.”
      ↩︎ What a bundle is and where its configuration lives
      “Notice that you do not need to declare the notebook_task mapping within the prod mapping”
      ↩︎ Targets: one bundle, several environments
      “Databricks recommends that you use the host mapping instead of the default mapping wherever possible”
      ↩︎ Targets: one bundle, several environments
      “it falls back to use the notebook_task mapping within the top-level resources mapping, if the notebook_task mapping is not explicitly overridden within the prod mapping”
      ↩︎ Checkpoint
      “The only valid value is "complex" if the variable is a complex variable, otherwise do not define this key.”
      ↩︎ Checkpoint
    2. 2.
      “Declarative Automation Bundles are an infrastructure-as-code (IaC) approach to managing your Databricks projects.”
      ↩︎ What a bundle is and where its configuration lives
      “Your bundle project's collection of source files and metadata is deployed as a single bundle to your target environment.”
      ↩︎ Key concept
    3. 3.
      “The REST API object's supported create request fields, expressed as YAML, are the resource's supported keys.”
      ↩︎ What a bundle is and where its configuration lives
      “The databricks bundle validate command returns warnings if unknown resource properties are found in bundle configuration files.”
      ↩︎ Validate, deploy, run, destroy, and what a deploy actually changes
    4. 4.
      “specify a configuration profile using the --profile (or -p) flag”
      ↩︎ Targets: one bundle, several environments
      “If a resource is removed from the bundle configuration, it is removed from the target workspace if it was previously deployed.”
      ↩︎ Validate, deploy, run, destroy, and what a deploy actually changes
      “It should only be used if the previous deployment crashed or was interrupted and left a stale lock file.”
      ↩︎ Validate, deploy, run, destroy, and what a deploy actually changes
      “If no command options are specified, the default target as declared within the bundle configuration files is used.”
      ↩︎ Exam trap 1
      “Resource names are not used to correlate between a bundle deployment and a resource instance”
      ↩︎ Exam trap 4
      “If no command options are specified, the default target as declared within the bundle configuration files is used.”
      ↩︎ Prediction
      “Resource names are not used to correlate between a bundle deployment and a resource instance”
      ↩︎ Checkpoint
      “If a resource in the bundle configuration exists in the target workspace, it is updated in the workspace.”
      ↩︎ Checkpoint
    5. 5.
      “Within any environment variables set that begin with BUNDLE_VAR_.”
      ↩︎ Custom variables and how the CLI resolves them
      “use the same approach during both the deployment and run stages.”
      ↩︎ Custom variables and how the CLI resolves them
      “The only valid value for the type setting is complex.”
      ↩︎ Custom variables and how the CLI resolves them
      “The Databricks CLI looks for values for variables in the following order, stopping when it finds a value for a variable:”
      ↩︎ Exam trap 2
    6. 6.
      “Pauses all schedules and triggers on deployed resources such as jobs or quality monitors.”
      ↩︎ Development mode, production mode and presets
      “Validates that all related deployed Lakeflow pipelines are marked as development: false.”
      ↩︎ Development mode, production mode and presets
      “presets override the default mode behavior, and settings of individual resources override the presets.”
      ↩︎ Development mode, production mode and presets
      “Validates that the current Git branch is equal to the Git branch that is specified in the target.”
      ↩︎ Exam trap 3
      “presets override the default mode behavior, and settings of individual resources override the presets”
      ↩︎ Checkpoint
    7. 7.
      “Destroying a bundle permanently deletes a bundle's previously-deployed jobs, pipelines, and artifacts. This action can't be undone.”
      ↩︎ Validate, deploy, run, destroy, and what a deploy actually changes
    8. 8.
      “To add a Python wheel file to a job task, in libraries specify a whl mapping for each library to be installed.”
      ↩︎ Declaring libraries and environments in bundle resources
      “Library dependencies are declared in your bundle configuration files.”
      ↩︎ Declaring libraries and environments in bundle resources

    Spotted a mistake, or was something unclear? Tell us.