Demo repository for a dbt notebook pattern in Microsoft Fabric plus Azure DevOps CI/CD templates for validating dbt changes and deploying Fabric workspace items.
Note: This repo contains example values in code (workspace names, URLs, etc.). The documentation below stays public-safe and uses placeholders.
- Fabric workspace item sources under
fabric-workspaces/ - Azure DevOps pipelines and deployment script under
.devops/- PR validation:
.devops/dbt-ci-validation.yml - Releases:
.devops/release-staging.yml,.devops/release-production.yml - Fabric deploy helper:
.devops/deploy-fabric-resources.py
- PR validation:
- Environment-specific replacement config (for Fabric item publishing):
parameter.yml
The notebook in notebook-content.py demonstrates a common “orchestrate dbt from Fabric” approach:
- Installs dbt adapter (
dbt-fabric) (see thepip installcell innotebook-content.py). - Retrieves runtime secrets using your preferred mechanism (the demo uses
notebookutils.credentials.getSecret(...)). - Clones a git repo at a chosen ref (
git_tag) (see clone logic innotebook-content.py). - Runs dbt steps via the Python CLI runner (
deps,debug,build) (see_run_dbt_step()). - Generates static dbt docs and copies artifacts (docs,
manifest.json,run_results.json) to the lakehouse file system (see docs + copy innotebook-content.py).
.devops/dbt-ci-validation.yml is a PR-oriented pipeline that:
- Detects changed dbt model SQL files.
- Installs Python dependencies using
uv. - Ensures dbt connectivity/syntax (
dbt debug,dbt deps,dbt parse). - Runs
sqlfluff lintagainst the changed files.
.devops/release-staging.ymldeploys on updates tomain(path-filtered tofabric-workspaces/*)..devops/release-production.ymldeploys on tags matchingv*.
Both call .devops/deploy-fabric-resources.py, which uses the fabric-cicd library to publish workspace items (see publish_all_items()).
parameter.yml defines find/replace rules applied during publishing to make the same Fabric item sources deployable across environments.
In this demo it includes:
- Regex replacements for Fabric notebook metadata IDs (default lakehouse + workspace IDs) (see rules in
parameter.yml). - An environment-specific switch for
is_prod(seeparameter.yml). - A regex replacement for
git_tagso STG/PROD can deploy from an environment-provided ref (seeparameter.yml).
-
Fabric notebook
- Import/open
fabric-workspaces/data-and-analytics/dbt.Notebook/notebook-content.pyin Fabric. - Replace the demo secret retrieval + repo clone pieces with your own approach (Managed Identity, Key Vault, or workspace secrets).
- Import/open
-
Azure DevOps
- Create a pipeline from
.devops/dbt-ci-validation.ymlfor PR validation. - Create release pipelines from
.devops/release-staging.ymland.devops/release-production.yml. - Configure an Azure service connection suitable for Fabric deployments (used by the
AzureCLI@2steps). - Update workspace names and repository directories in the YAML parameters to match your repo.
- Create a pipeline from
.
├── .devops/ # Azure DevOps pipeline templates + deploy script
├── fabric-workspaces/ # Fabric workspace item sources (Notebook, etc.)
├── parameter.yml # Environment replacement rules for publishing
└── LICENSE
MIT — see LICENSE.