What you will be able to do
- Explain how databricks bundle deploy chooses a target and how a bundle's identity and deployment state decide whether resources are created, updated or removed
- Choose the right deploy flag: --auto-approve, --cluster-id, --fail-on-active-runs, --force, --force-lock or --select
- Compare development and production deployment modes, and work out how mode, presets and per-resource settings combine
- Bring an existing workspace job or pipeline under bundle management with bundle deployment bind
1.bundle deploy, bundle identity and deployment state
databricks bundle deploy pushes a bundle to a remote workspace. Pass -t (or --target) to choose a target. If you pass no target, the CLI uses the bundle's default target. The same bundle can go to development, staging and production workspaces, and each of those deployments has its own identity. That identity comes from root_path, which defaults to ~/.bundle/${bundle.name}/${bundle.target}. So by default a deployment is identified by who deployed it, the bundle name and the target name. If two bundles share all three, their deployments will interfere with each other.
A deployment stores state in the workspace file system that records the ID of each resource it created. On every deploy, a resource that is in the configuration but not in the workspace is created. A resource that is in both is updated. A resource that was deployed before but has since been removed from the configuration is deleted from the target workspace. The only way to make a deployment forget a resource is to change the bundle name, the target, or the workspace. databricks bundle validate prints a summary of those values.
Checkpoint 1 of 7· Check yourself
An engineer removes a job definition from resources.jobs in a bundle that was already deployed to staging, then runs databricks bundle deploy -t staging. What happens to the job in staging?
Deployment state tracks every resource the bundle deployed. When one disappears from the configuration, the next deploy removes it from the target workspace.
“If a resource is removed from the bundle configuration, it is removed from the target workspace if it was previously deployed.”Source: docs.databricks.com
Checkpoint 2 of 7· 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?
Correct answer: A — The `dev` target, because it is the only target marked `default: true` and the CLI resolves an omitted `-t` flag to that target automatically.
- A. Exactly one target may be marked `default: true`, and when `-t` is omitted the CLI resolves the deployment to that target, so this bundle deploys to `dev` without any further input from the engineer.
- B. Target resolution does not depend on declaration order; the CLI looks for a target flagged `default: true` rather than falling back to whichever target happens to appear last in the file.
- C. An omitted `-t` flag is only an error when no target in the file is marked as the default; since one target is explicitly flagged `default: true` here, the CLI has an unambiguous target to resolve to and proceeds.
- D. Each bundle deploy command targets exactly one target per invocation; there is no fan-out behavior that deploys the same bundle configuration to multiple targets in a single command.
Sources1
2.Deploy flags and when to use each
| Flag | What it does | Caution |
|---|---|---|
| --auto-approve | Skips interactive approvals that deployment might require | Useful in non-interactive CI |
| -c, --cluster-id | Overrides the cluster in the deployment with the given cluster ID | Not allowed in production mode (see next section) |
| --fail-on-active-runs | Fails if jobs or pipelines in the deployment are running | Protects in-flight runs |
| --force | Overrides validations that block a deployment, including the Git branch check; overwrites dashboards modified in the workspace | Remote dashboard edits are lost |
| --force-lock | Forces acquisition of the deployment lock | Only after a crashed or interrupted deploy left a stale lock |
| --select | Deploys only the named resources and their upstream dependencies | Development workspaces only; downstream resources are not updated |
--force and --force-lock are easy to mix up. --force gets past validations, such as deploying from a branch other than the target's configured git.branch. --force-lock is about the deployment lock, which stops concurrent deployments from interfering with each other. --select takes resource keys, optionally qualified by type, and you can repeat it or comma-separate the keys:
databricks bundle deploy --select my_job
databricks bundle deploy --select jobs.my_job --select pipelines.my_pipeline
databricks bundle deploy --select my_job,my_pipelineCheckpoint 3 of 7· Check yourself
A CI deploy crashed halfway. Every new deploy now fails because a lock is held. Which flag is meant for this situation?
--force-lock takes the deployment lock by force. It is meant for exactly this case, a stale lock left by a crashed or interrupted deployment. --force bypasses validations such as the Git branch check, not the lock.
“It should only be used if the previous deployment crashed or was interrupted and left a stale lock file.”Source: docs.databricks.com
Sources1
3.Development and production deployment modes
A target can set mode, which applies a group of default behaviours that match a stage of CI/CD. Modes are optional, and you can deploy without one. The two modes behave very differently:
databricks bundle deploy -t <target> does in each mode| Behaviour | mode: development | mode: production |
|---|---|---|
| Resource names | Prefixed with [dev ${workspace.current_user.short_name}] and tagged dev | Unchanged |
| Lakeflow pipelines | Marked development: true | Validated to be development: false |
| Cluster override | --cluster-id or cluster_id overrides all cluster definitions | Overriding existing cluster definitions is not allowed |
| Schedules and triggers | Paused | Not paused by the mode |
| Concurrent runs / lock | Concurrent runs enabled; deployment lock disabled | Not listed as mode behaviours |
| Git branch | No check | Current branch must equal the target's git branch (bypass with --force) |
Checkpoint 4 of 7· Fill the gap
Which value makes this target prefix resource names, pause schedules and allow --cluster-id overrides?
targets:
dev:
mode: ? Only mode: development turns on those behaviours. dev is the target's name, not a mode value.
Databricks recommends service principals for production deployments, enforced by setting run_as to a service principal. Without one, production mode adds extra checks. artifact_path, file_path, root_path and state_path must not be overridden to a specific user, and run_as and permissions must be specified. Deploying to an immutable, read-only folder means non-admin users can't change deployed assets and running jobs aren't affected by a deployment in progress.
Presets let you change individual mode behaviours. Unless a preset documents an exception, presets override the mode, and a resource's own settings override the presets:
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: financeCheckpoint 5 of 7· Check yourself
A job sets max_concurrent_runs: 10. Its target sets the preset jobs_max_concurrent_runs: 20 and also uses mode: development. What is the job's maximum number of concurrent runs after deployment?
The order of precedence is mode, then presets, then the individual resource. The job's own value of 10 wins.
“if both mode and presets are set, presets override the default mode behavior, and settings of individual resources override the presets.”Source: docs.databricks.com
Checkpoint 6 of 7· 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)
Correct answers: A, B, C — Deployed job and pipeline names are prefixed with a `[dev <username>]` tag derived from the current user's short name.; Any schedules or triggers attached to deployed jobs and pipelines are paused so they do not fire unexpectedly during iteration.; Jobs deployed to the target allow concurrent runs so the engineer can trigger multiple test executions without waiting for a prior run to finish.
- A. Development mode's default name-prefixing behavior prepends a `[dev <short_name>]` tag to resource names, which is exactly how deployed jobs and pipelines end up visibly scoped to the deploying user during iteration.
- B. Pausing schedules and triggers is a documented development-mode default, preventing a job or pipeline the engineer is still editing from firing on its production schedule while it is redeployed repeatedly.
- C. Development mode also enables concurrent runs on deployed jobs by default, which lets an engineer kick off a new test run without waiting for an earlier iteration's run to finish first.
- D. Enforcing that the local branch match a target's configured branch is a production-mode validation, not a development-mode default; development targets are meant to tolerate branch-switching during iteration.
- E. Development mode does the opposite: it marks Lakeflow pipeline resources with `development: true` so pipeline runs use development-friendly behavior rather than mirroring the production execution path.
- F. Requiring a service principal identity is a production-mode recommendation enforced through validation, not something development mode imposes; development targets commonly run as the deploying individual user.
Sources2
4.Bringing existing resources under a bundle with bind
Jobs and pipelines created in the UI or through the API can be adopted rather than recreated. databricks bundle generate writes YAML for an existing resource, and databricks bundle deployment bind KEY RESOURCE_ID links a bundle resource key to the existing object. After the next bundle deploy, the workspace resource is updated to match the bundle's configuration. Bind does not recreate data. For example, a bound pipeline keeps its data and its materialized views don't have to be recomputed. Use bind with --target. It prints a diff and asks you to confirm unless you pass --auto-approve. databricks bundle deployment unbind KEY removes the link.
databricks bundle deployment bind hello_job 6565621249Checkpoint 7 of 7· Match them up
Match each resource type to the RESOURCE_ID format bind expects
Tap a term, then the definition that fits it.
Bind looks up the resource with the GET REST endpoint. Jobs and pipelines are identified by ID, and Unity Catalog objects by their full name.
“schema: full name in catalog.schema form, such as my_catalog.my_schema”Source: docs.databricks.com
Sources1
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Renaming a job's name field in the YAML detaches it from the deployed job, so the next deploy creates a fresh job.Why is that wrong?
The deployment tracks resources by ID in its state, not by name. A deployment forgets a resource only if the bundle name, target or workspace changes.
Covered in bundle deploy, bundle identity and deployment state
2.--select is a safe way to push one hotfixed job to production without redeploying the whole bundle.Why is that wrong?
--select is recommended for development workspaces only. It deploys the selected resources and their upstream dependencies but leaves downstream resources stale, which can cause dependency errors.
Covered in Deploy flags and when to use each
3.Production mode, like development mode, lets you point every job at a different cluster with --cluster-id at deploy time.Why is that wrong?
Cluster overrides are a development-mode behaviour. Production mode does not allow overriding the cluster definitions in the configuration.
Covered in Development and production deployment modes
Practise it for real
Create a bundle from a template, deploy it to a development target, and run its job.
1.Run
databricks auth login --host <workspace-url>and accept the suggested profile name.Why: The CLI needs an authenticated profile for the target workspace; U2M is fine for interactive work.
You should see: A browser login, after which a configuration profile is saved.
2.Run
databricks bundle initand choose the default Python template.Why: Templates are the quickest way to get a valid databricks.yml, a notebook and a job definition.
You should see: A new project folder containing databricks.yml and resource files.
3.From the project folder, run
databricks bundle validate.Why: Validation catches configuration errors and warns about unknown resource properties before anything is deployed.
You should see: A summary of the bundle name, target and workspace, plus any warnings.
4.Run
databricks bundle deploy -t dev.Why: This deploys to the development target; if it uses mode: development, resources get the [dev <your name>] prefix and schedules are paused.
You should see: The job appears in the workspace with the dev prefix.
5.Run
databricks bundle run -t devwith the job's resource key.Why: bundle run starts the deployed workflow from the command line.
You should see: A job run starts and its progress is reported.
Stuck? Get a nudge
If deploy fails on a lock left by an interrupted earlier attempt, that is what --force-lock is for. Don't reach for --force.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Fundamentally, the root_path property is what determines a bundle's unique identity, which defaults to ~/.bundle/${bundle.name}/${bundle.target}.”
↩︎ bundle deploy, bundle identity and deployment state“If no command options are specified, the default target as declared within the bundle configuration files is used.”
↩︎ bundle deploy, bundle identity and deployment state“tracks the resources it creates in the target workspace by their IDs as a state that is stored in the workspace file system”
↩︎ bundle deploy, bundle identity and deployment state“--force overrides Git branch validation”
↩︎ Deploy flags and when to use each“Fail if there are running jobs or pipelines in the deployment.”
↩︎ Deploy flags and when to use each“Bind does not recreate data.”
↩︎ Bringing existing resources under a bundle with bind“the existing Databricks resource in the workspace is updated based on the configuration defined in the bundle”
↩︎ Bringing existing resources under a bundle with bind“A resource's association with a bundle can only be forgotten if you change the bundle name, the bundle target, or the workspace.”
↩︎ Exam trap 1“Databricks recommends only using this option for deploying resources to development workspaces. It is not intended for use in production.”
↩︎ Exam trap 2“Resource names are not used to correlate between a bundle deployment and a resource instance”
↩︎ Prediction“If a resource is removed from the bundle configuration, it is removed from the target workspace if it was previously deployed.”
↩︎ Checkpoint“It should only be used if the previous deployment crashed or was interrupted and left a stale lock file.”
↩︎ Checkpoint“schema: full name in catalog.schema form, such as my_catalog.my_schema”
↩︎ Checkpoint - 2.
“Pauses all schedules and triggers on deployed resources such as jobs or quality monitors.”
↩︎ Development and production deployment modes“Validates that the current Git branch is equal to the Git branch that is specified in the target.”
↩︎ Development and production deployment modes“Databricks recommends that you use service principals for production deployments.”
↩︎ Development and production deployment modes“setting the mode mapping to production does not allow overriding any existing cluster definitions that are specified in the related bundle configuration file”
↩︎ Exam trap 3“if both mode and presets are set, presets override the default mode behavior, and settings of individual resources override the presets.”
↩︎ Checkpoint