Harness bridge
Scaffold, mock-run, build, and deploy Databricks projects with fabric-cli databricks — a secure bridge to the Fabric Harness CLI (fh).
The Databricks skill delegates scaffolding, build, and deploy to Fabric Harness. The bridge maps fabric-cli databricks commands to fh invocations, strips unrelated secrets from the child environment, redacts tokens from all output, and gates live runs behind an explicit environment variable.
Compatibility negotiation
Before the bridge executes a Harness command, it checks both the installed CLI version and its machine-readable capabilities:
fh --version
fh capabilities --jsonDesktop requires Fabric Harness CLI 6.7.4 or newer within the supported 6.x line (Node.js 22 or newer), CLI protocol 1, build manifest 2, both Databricks build targets, and the sdk.define-agent, preview, App build/deploy, and AI Gateway features. A CLI that does not provide the expected contract fails closed with an actionable compatibility error; there is no silent legacy fallback.
flowchart TD
A[Fabric Desktop or fabric-cli] --> B[Databricks Harness bridge]
B --> C[Resolve project-local or PATH fh]
C --> D[Version range check]
D --> E[Capability contract check]
E --> F[Allow-listed environment and redaction]
F --> G[Fabric Harness command]
G --> H[Databricks App, Model Serving, or local mock]Bundled templates declare compatible Harness package ranges (@fabric-harness/cli ^6.7.4, sdk/node ^6.5.0, databricks ^7.1.1, temporal ^2.2.3) and engines.node >=22. Desktop CI tests the minimum certified version and npm latest; Harness release CI can also pack an unpublished CLI and run it through this same bridge contract before release.
Local CLI and server mode
There are three related execution surfaces:
| Surface | Where the command runs | Where fh is installed | Best use |
|---|---|---|---|
fh ... | Current terminal | Project or terminal PATH | Direct Harness development and debugging |
fabric-cli databricks ... | Current terminal through the Desktop bridge package | Project or terminal PATH | Repeatable scaffold, mock, build, and deploy automation |
| Fabric server mode | Fabric server host | On the server host when a server-side workflow delegates to Harness | Remote Desktop sessions and centralized credentials |
The bridge prefers a project-local node_modules/.bin/fh, then falls back to PATH. This keeps a project reproducible while still supporting a globally installed CLI. In server mode, credentials and the Harness executable belong on the server; the browser or remote client should never receive workspace tokens. Use TLS and server authentication whenever the server listens beyond loopback.
For local development, verify the selected executable and contract before a run:
command -v fh
fh --version
fh capabilities --json
fabric-cli databricks deploy --target databricks-app --previewCommands
| Fabric Agents command | Harness equivalent | Purpose |
|---|---|---|
fabric-cli databricks init | fh init --template databricks | Scaffold a new Databricks project |
fabric-cli databricks init --template governed-analytics-copilot | (bundled template copy) | Scaffold the Governed Analytics Copilot |
fabric-cli databricks run --mock | fh run <agent> --mock | Validate structure without live API calls |
fabric-cli databricks run --mock --question "..." | fh run <agent> --mock --payload '{"question": "..."}' | Run a single question in mock mode |
fabric-cli databricks run | fh run <agent> | Live run against workspace (requires FABRIC_DATABRICKS_TEST=1) |
fabric-cli databricks build --target databricks-app | fh build --target databricks-app | Build Databricks App bundle |
fabric-cli databricks build --target databricks-serving | fh build --target databricks-serving | Build Model Serving wrapper |
fabric-cli databricks deploy --target ... --preview | fh deploy --target ... --preview | Preview deploy (dry run) |
fabric-cli databricks deploy --target ... | fh deploy --target ... | Live deploy |
fabric-cli databricks preview | fh deploy --target ... --preview | Alias for preview deploy |
The bundled templates (governed-analytics-copilot, lakebase-rag-agent, data-engineering-agent) are copied directly from the app's resources; any other template name delegates to fh init. The default agent for run is analyst — override with --agent <name>.
Deploy targets
| Target | What it builds | What deploy does |
|---|---|---|
databricks-app | A Databricks Asset Bundle with a Node server, Dockerfile, app.yaml, and databricks.yml | Runs databricks bundle deploy (falls back to databricks apps deploy) |
databricks-serving | An MLflow ChatAgent wrapper (serving/model.py) that proxies to a deployed agent URL | Registers the model in Unity Catalog and creates a Model Serving endpoint |
Note:
databricks-servingis a wrapper target — the agent itself must already be reachable over HTTP (typically deployed first viadatabricks-app, with its URL stored as a Databricks secret). Deploydatabricks-appbeforedatabricks-serving.
Live deploys require the Databricks CLI on your PATH; the serving target additionally needs Python with mlflow and databricks-sdk installed.
Security model
- Live gate — live
runcommands are disabled unlessFABRIC_DATABRICKS_TEST=1is set. Mock runs never require it. - Secret stripping — before spawning
fh, the bridge removes unrelated cloud credentials (AWS, Azure, Google, GitHub, OpenAI, Anthropic, Slack) from the child environment. - Redaction — Databricks PATs (
dapi...), bearer tokens, and other secret-shaped strings are replaced with***REDACTED***in all command output. - Mock isolation — in mock mode the bridge deletes
DATABRICKS_HOST,DATABRICKS_TOKEN, and OAuth variables from the child environment so a "mock" run can never accidentally reach a live workspace. - Attribution — every run sets
FABRIC_USER_AGENT=fabric-agents/<version>so requests are identifiable in Databricks audit logs.
--mock flag
--mock runs the command using MockDatabricksModelProvider, returning canned responses without making any live API calls. Use it for onboarding, CI, and local development when you don't have workspace credentials.
fabric-cli databricks run --mock
fabric-cli databricks build --target databricks-app --mock
fabric-cli databricks deploy --target databricks-app --preview --mockNote: Of the bundled templates, only the Governed Analytics Copilot supports mock mode. The RAG and data engineering templates are live-only — see Templates.
Preview mode
--preview performs a dry-run deploy: it validates the bundle, resolves variables, and prints the deployment plan without creating or modifying any Databricks resources. Use it to review changes before a live deploy.
fabric-cli databricks deploy --target databricks-app --previewOutput includes:
- Resources that would be created, updated, or deleted.
- Variable resolutions (secrets redacted).
- Any validation errors that would block a live deploy.
No side effects occur in the workspace. Preview deploys don't require credentials, so they are safe to run in CI or during code review.
Workspace discovery on init
When you run databricks init from the chat agent with a connected Databricks source, the handler discovers workspace metadata before scaffolding and injects it into the generated project:
- The first running SQL warehouse (falling back to the first warehouse)
- The first non-system catalog (preferring
main) - The default schema in that catalog
- The first Genie space, if any
The scaffolded .env.example is pre-filled with these non-secret IDs, and fabric.config.ts is rewritten to reference process.env.* variables instead of literal values. Secrets are never written — only resource identifiers. If discovery fails, scaffolding still succeeds with placeholder values.
Mock-run happy path
The mock-run happy path lets a developer scaffold and validate a Databricks project without live credentials or workspace access.
-
Ensure
fhis installed and on yourPATH:command -v fh -
Scaffold the project:
fabric-cli databricks init --template governed-analytics-copilot -
Run in mock mode:
fabric-cli databricks run --mock --question "What tables are in main?"The agent executes with
MockDatabricksModelProvider, returning canned responses. No API calls are made. -
Validate the build target:
fabric-cli databricks build --target databricks-app --mock -
Preview deploy (still no side effects):
fabric-cli databricks deploy --target databricks-app --preview --mock -
Iterate on agent definitions and skills, then repeat steps 3–5.
-
Go live — set the live gate and credentials, then run without
--mock:export FABRIC_DATABRICKS_TEST=1 export DATABRICKS_HOST="https://<workspace-host>.cloud.databricks.com" export DATABRICKS_TOKEN="dapi..." fabric-cli databricks run --question "What tables are in main?" fabric-cli databricks deploy --target databricks-app
What you proved:
- Agent definitions parse correctly.
- Tools (
sql,tables,table-info) are registered. - Bundle structure is valid for the chosen target.
- No live credentials were required.
Credential passing
Always use short-lived environment variables. Never write secrets into generated files.
export DATABRICKS_HOST="https://<workspace-host>.cloud.databricks.com"
export DATABRICKS_TOKEN="<short-lived-pat>"
# Or for OAuth:
export DATABRICKS_CLIENT_ID="<service-principal-id>"
export DATABRICKS_CLIENT_SECRET="<service-principal-secret>"Generated databricks.yml uses safe env var references:
workspace:
host: ${DATABRICKS_HOST}
auth_type: tokenRequired privileges and safe defaults
Safe defaults
- Explore mode allows only
GETendpoints. - Cluster mutations (start, stop, terminate) require
askorallow-allpermission mode. - Unity Catalog mutations (CREATE, DROP, ALTER) are gated behind
askorallow-all. - The agent never writes secrets into scaffolded files.
Minimum privileges
| Resource | Minimum privilege | Why |
|---|---|---|
| Workspace | CAN READ | List clusters, jobs, pools |
| Unity Catalog | BROWSE + USE CATALOG | Discover catalogs, schemas, tables |
| SQL Warehouse | CAN USE | Execute queries via Statement Execution API |
| Tables | SELECT | Read table data |
Related
- Templates — the three bundled workload templates
- Fabric CLI reference — full
fabric-clicommand surface - Troubleshooting — common errors and fixes
Templates
Three bundled Databricks App templates — Governed Analytics Copilot, Lakebase Stateful RAG Agent, and Data Engineering Agent — with least-privilege grants and mock testing.
Platform services
Extend the Databricks integration with Mosaic AI Model Serving, AI Gateway guardrails, Genie natural-language analytics, Vector Search RAG, SQL warehouses, and a read-only Unity Catalog browser.