DevOps et observabilité
Deploy a Fabric Solution with Git, Deployment Pipelines and Database Projects
A hands-on Microsoft Fabric lifecycle lab: version a workspace with Git integration, promote it from Dev to Test with a deployment pipeline and deployment rules, change a Warehouse schema as a database project, cause two controlled deployment failures and plan rollback.
Dans cet article
Microsoft Fabric gives you three lifecycle tools that are easy to confuse: Git integration, deployment pipelines and database projects. They overlap in the portal, and all three show up whenever someone says “Fabric CI/CD”. This lab uses all three on one small solution, so you see what each one is for, what each one is not for, and what happens when they disagree.
You will connect a Dev workspace to Git, change items through commits, promote them to a Test workspace with a deployment pipeline, fix an environment-specific setting with a deployment rule, change a Warehouse schema as code, and cause two deployment failures on purpose.
The three tools
| Tool | What it is for | What it is not for |
|---|---|---|
| Git integration | Version control of supported item definitions in a workspace: history, branches, pull requests, revert | Promoting between environments, copying data, storing secrets, workspace permissions or most settings |
| Deployment pipelines | Promoting items from one stage workspace to the next (Dev → Test → Prod), comparing stages, applying deployment rules | Version history or code review; it copies the current state of the source stage, whatever it is |
| Database projects | Schema as code for a Warehouse: .sql files, a build that validates them into a .dacpac, a schema-aware deploy that applies only the differences |
Moving data, managing users and permissions, versioning non-SQL items |
They meet in one place: when a Git-connected workspace contains a Warehouse, Fabric commits that Warehouse as a database project. The schema in your repository is the same project you can build and publish from Visual Studio Code.
- 1ChangeIn Fabric or in VS Code
- version2CommitGit repository, branch main
- 3BuildDatabase project → .dacpac
- 4Update DevWorkspace syncs from Git
- promote5Deploy to TestPipeline, compare, rules
- 6ValidateData, bindings, security
Prerequisites
- Two workspaces on a trial or test capacity, where you are Admin:
ws_lifecycle_devandws_lifecycle_test. - Two more small workspaces for the reference data used in Break 1:
ws_lifecycle_data_devandws_lifecycle_data_test. - A Git repository you can push to, on Azure DevOps, GitHub or GitHub Enterprise (cloud), and Git integration allowed by your Fabric admin. If you have never connected a workspace, do Connect Microsoft Fabric to Git first: this lab doesn’t repeat those screens.
- Visual Studio Code with the SQL Database Projects and SQL Server (mssql) extensions, and the .NET SDK.
- The
customers.csvfile from the Lab 01 dataset.
Setup
In ws_lifecycle_dev:
-
Create a Lakehouse
lh_sales, uploadcustomers.csvtoFiles/landing, and create a Warehousewh_sales. -
Create a notebook
nb_load_customerswithlh_salesas its default Lakehouse:df = (spark.read.option("header", True).option("inferSchema", True) .csv("Files/landing/customers.csv")) df.write.mode("overwrite").saveAsTable("customers") print(f"loaded {df.count()} customers")PySpark4 lignesCellule d’exemple en lecture seule. Rien sur cette page n’exécute de code. -
In
wh_sales, create one table and load it from the Lakehouse:CREATE TABLE dbo.customers AS SELECT customer_id, first_name, last_name, email, segment, city, [state], country FROM lh_sales.dbo.customers;T-SQL (Fabric Warehouse)3 lignesAffichage en lecture seule. Aucune connexion à une base de données.
In ws_lifecycle_data_dev and ws_lifecycle_data_test: create a Lakehouse lh_reference in each, with a one-row table that says which environment it belongs to. Run this in a notebook attached to each Lakehouse, with the right value:
spark.createDataFrame([("dev",)], ["env"]).write.mode("overwrite").saveAsTable("env_marker")
# in ws_lifecycle_data_test, use ("test",)
Step 1: Connect Dev to Git and commit
- In
ws_lifecycle_dev, open Workspace settings → Git integration, connect to your repository, branchmain, folderfabric. - Open Source control and commit every item with the message
initial lifecycle lab. - Open the repository and look at what was stored:
| In the repository | What it is |
|---|---|
nb_load_customers.Notebook/notebook-content.py |
The notebook as source, including its default Lakehouse in metadata; no cell output |
lh_sales.Lakehouse/ |
Lakehouse metadata (name, shortcuts if any); no customers table, no CSV |
wh_sales.Warehouse/ |
A database project: a .sqlproj file and one .sql file per object, including the customers table definition |
Expected result: three items committed, and no data anywhere in the repository. A search for example.com should find no match: Microsoft documents that Lakehouse tables and files aren’t tracked in Git (what is tracked), and that the Warehouse is committed as a database project (Warehouse Git integration).
Step 2: Change workflow
- Change in Fabric. In
nb_load_customers, add a cell that prints the row count by state. Commit it from Source control. Check that the commit appears in the repository history. - Change in Git. In the repository, edit
notebook-content.pyand change the message in the print statement. Commit tomain. - In
ws_lifecycle_dev, Source control now shows an incoming update. Select Update all, open the notebook and confirm it shows your Git change.
Expected result: the workspace and the branch are in sync in both directions. A team adds branches and pull requests on top of this; Git Integration in Microsoft Fabric: A Practical Development Workflow covers branching out, protected main and conflict resolution.
Step 3: Promote Dev to Test with a deployment pipeline
- Create a deployment pipeline
dp_lifecycle_labwith two stages, Development and Test. - Assign
ws_lifecycle_devto Development andws_lifecycle_testto Test. - Select all three items in Development and Deploy to Test.
- Open
ws_lifecycle_testand check each item:
| Item in Test | Expected result |
|---|---|
lh_sales |
A new, empty Lakehouse: no table, no files. Microsoft documents that deployment creates a new empty Lakehouse and never overwrites data |
nb_load_customers |
Deployed and bound to the Test lh_sales: notebook auto-binding applies when the dependency is in the same workspace and deployed with it |
wh_sales |
The dbo.customers table exists, with no rows: Warehouse deployments apply schema, not data |
- Run
nb_load_customersin Test. Expected result: it fails, becauseFiles/landingis empty in the Test Lakehouse. Upload the CSV there and run it again.
Expected result: the pipeline promotes definitions, and you provide the data for the new environment yourself. That is by design: each environment owns its data. Sources: Lakehouse deployment pipelines, notebooks in deployment pipelines.
Step 4: Environment-specific configuration (Break 1)
The deployment above worked because everything the notebook used was inside the deployed workspace. Now make the notebook depend on something outside it.
Break it.
-
In Dev, change
nb_load_customers’s default Lakehouse tolh_referenceinws_lifecycle_data_dev, and add a cell:spark.sql("SELECT env FROM env_marker").show() -
Commit, then deploy the notebook from Development to Test again.
-
Run the notebook in
ws_lifecycle_test.
Expected symptom: the Test notebook prints dev. Nothing fails, which makes this the dangerous kind of deployment problem: Test reads Dev’s data.
Diagnose. Microsoft documents notebook auto-binding for dependencies in the same workspace; lh_reference lives in another workspace, so the Test copy is expected to keep the Dev reference stored in its metadata. Check which Lakehouse, and which workspace, the Test notebook is attached to.
Fix it with a deployment rule.
- In the pipeline, select the Test stage, then Deployment rules, then
nb_load_customers. - Add a Default lakehouse rule: from
lh_reference(Dev) to Other, and enter the Testlh_referenceLakehouse ID, name and workspace ID. The IDs are in the item’s URL. - Deploy the notebook to Test again. Rules only take effect on the next deployment.
- Run the notebook in Test. Expected result:
test. Microsoft documents that a deployment rule takes priority over auto-binding.
Deployment rules have conditions worth remembering (deployment rule limitations): you must own the item to create one, rules are created on target stages (never on the first stage), and a rule is lost if the item is deleted or the workspace is unassigned from the pipeline. For values that differ by environment across many items, look at variable libraries, which are supported in both Git integration and deployment pipelines; for code-first deployment with parameter files, see Microsoft Fabric CI/CD with fabric-cicd.
Step 5: Change the Warehouse as a database project
Now change the Warehouse schema in code, validate it with a build, and let Git and the pipeline carry it.
-
Clone the repository and open the
wh_sales.Warehousefolder in Visual Studio Code. The Database Projects view should list the project. -
Open the
.sqlprojfile and check the SDK version. Only SDK-style projects are supported for Fabric Warehouse, and an outdatedMicrosoft.Build.Sqlversion can fail on newer Warehouse syntax. Microsoft’s guide shows the expected structure; take current version numbers from NuGet rather than from an old example:<Sdk Name="Microsoft.Build.Sql" Version="2.3.0" /> -
Add a view as a new file next to the existing object files, for example
v_customers_by_state.sqlin the schema’s views folder:CREATE VIEW dbo.v_customers_by_state AS SELECT [state], segment, COUNT(*) AS customers FROM dbo.customers GROUP BY [state], segment;T-SQL (Fabric Warehouse)4 lignesAffichage en lecture seule. Aucune connexion à une base de données. -
Build the project (right-click → Build, or from a terminal):
dotnet buildExpected result: a successful build and a
.dacpacunderbin/Debug, as Microsoft’s guide describes. (If the extension’s build fails immediately on Windows, Microsoft currently requires PowerShell as the VS Code default terminal.) An invalid object definition should fail here, before any workspace sees it. That is the main value of building: the build is the test that a CI pipeline runs on every pull request. -
Commit and push. In
ws_lifecycle_dev, Source control shows an incoming change towh_sales: select Update all. Microsoft documents that Fabric applies the difference to the Warehouse with an incremental, DacFx-based schema deployment. Query the view in Dev. -
In the deployment pipeline, select Compare between Development and Test. The comparison should list the new view for the Warehouse. Deploy it to Test and query it there.
Expected result: one view written as code, validated by a build, applied to Dev from Git and promoted to Test, with the data in both Warehouses untouched. Sources: Warehouse Git integration, deploy Warehouse with pipelines.
Step 6: A blocked deployment (Break 2)
Database deployments are designed to stop when a change could destroy data. Trigger that on purpose, against a disposable copy.
- Create a Warehouse
wh_sandboxinws_lifecycle_devand loaddbo.customersinto it with the sameCREATE TABLE … AS SELECTas in Setup. - In VS Code, publish the project to
wh_sandboxonce (right-click → Publish, choose the Warehouse connection, Generate Script first, review it, then Publish), so the sandbox matches the project. Save the publish profile when asked. - Now delete the
emailcolumn from thecustomerstable file, build, and publish towh_sandboxagain with Generate Script.
Expected symptom: the deployment should be blocked because the change would cause data loss: the table has rows, and dropping a column would destroy them. The exact wording depends on the tool and version, so record the message you get. Microsoft documents that deployment pipelines always deploy Warehouses with this protection on (Warehouse deployment configurations).
Diagnose. Review the generated script for the column drop, and the publish output for the data-loss reason. The deployment setting behind the block is BlockOnPossibleDataLoss, which Microsoft recommends keeping on in production (important deployment settings).
Fix. Decide on purpose. Either restore the column in the project (the usual answer), or, in a sandbox only, back up the data first and publish with the protection off:
SqlPackage /Action:Publish \
/SourceFile:bin/Debug/<project-name>.dacpac \
/TargetConnectionString:"Server=<id>.datawarehouse.fabric.microsoft.com;Database=wh_sandbox;Authentication=Active Directory Interactive" \
/p:BlockOnPossibleDataLoss=False
Then restore the column in the project before you commit anything: this change must never reach main.
Two related behaviours to know before you rely on pipelines for Warehouse changes. Deployments through pipelines don’t drop objects that exist only in the target, and a deployment can report success while skipping a requested table drop; compare the stages afterwards to catch the drift. They also exclude users and permissions, so security such as the grants and policies from the Fabric Security Lab has to be applied per environment, for example with a reviewed script.
Troubleshooting
These rows come from Microsoft’s documented behaviour and limitations for Git integration, deployment pipelines and Warehouse source control, not from incidents reproduced for this lab.
| Symptom | Likely cause | Fix |
|---|---|---|
| Test notebook reads Dev data | Dependency outside the deployed workspace; no rule | Default lakehouse rule on the Test stage, then redeploy |
| A rule exists but nothing changed | Rules apply on the next deployment | Deploy the item again |
| Deployment rules is greyed out | You aren’t the item’s owner, or you’re on the first stage | Take over the item or ask its owner; create the rule on the target stage |
| A second copy of an item appears in Test | The items weren’t paired, so deployment created a new one | Pair by assigning the workspace with matching items, or remove the duplicate and redeploy |
| Test Lakehouse or Warehouse is empty | Data is never deployed | Load data per environment |
| Update from Git fails on the Warehouse | Outdated .sqlproj SDK, a three-part name referencing the same Warehouse, or a cyclic reference between Warehouses |
Update the SDK version; use two-part names inside the Warehouse; remove the cycle |
| Warehouse users or grants missing in Test | Security objects are excluded from Warehouse deployments | Apply security per environment |
| Pipeline says success but a table still exists in Test | Table drops are blocked by default | Compare stages; drop deliberately if intended |
Commits blocked by an unexpected DataflowsStagingWarehouse item |
A Dataflow Gen2 writes to the Warehouse | Avoid that pattern in Git-connected Warehouse workspaces for now |
Rollback and recovery expectations
| What went wrong | What rolls it back | What doesn’t come back |
|---|---|---|
| A bad notebook or pipeline change | Revert the commit in Git, update the workspace, redeploy to later stages | Run history and outputs of the bad runs |
| A bad Warehouse schema change | Revert the project change, or restore the Warehouse in place from a restore point (system restore points every eight hours, plus user-defined ones) | Restore in place overwrites the whole Warehouse, including data written since the restore point |
| Wrong data loaded into a table | Delta time travel and Warehouse restore points, within retention | Git: it never had the data |
| A deleted workspace or item | Item and workspace recovery within the tenant’s retention | Anything not recreated from Git, such as settings, roles and data |
Create a user-defined Warehouse restore point before a risky schema deployment. For the full recovery design, including what Microsoft recovers and what you rebuild, see Recovery and Disaster Recovery Architecture for Microsoft Fabric.
Explain
Answer these without notes:
- Why do you need both Git and a deployment pipeline? Git records what changed and who approved it; the pipeline decides which environment gets which state, with rules for what differs per environment.
- Where does a database project fit? It is the Warehouse’s schema as code. The build validates it; a schema-aware deploy applies only differences and refuses to lose data unless told to.
- What does none of the three protect? Data, secrets, workspace roles and most settings. Those need their own process: load per environment, a secret store, scripted security and the recovery design.
Cleanup
- Delete the deployment pipeline
dp_lifecycle_lab(this doesn’t delete the workspaces). - Disconnect
ws_lifecycle_devfrom Git, then delete the four workspaces. - Keep or archive the repository: its history is the evidence of this lab.
What this lab doesn’t cover
- Branch-per-developer workflows and pull request policies: see Git Integration in Microsoft Fabric.
- Code-first deployment from a CI/CD runner with a service principal: see Microsoft Fabric CI/CD with fabric-cicd and the Fabric CI/CD deployment checklist.
- Workspace settings that each environment needs, which mostly don’t move with Git or pipelines: see the Microsoft Fabric Workspace Settings Cheat Sheet.
Lab 06 in the labs roadmap will apply the same workflow to the Lab 01 sales platform.
Sources
Last verified against Microsoft Learn: November 2026.
- Overview of Fabric Git integration: providers, supported items.
- Overview of Fabric deployment pipelines: stages, pairing, supported items.
- Create deployment rules: rule types and limitations.
- Notebook source control and deployment: notebook format in Git, auto-binding, default lakehouse rules.
- Lakehouse Git integration and deployment pipelines: what is and isn’t tracked.
- Git integration for Fabric Warehouse development and deploy Fabric Data Warehouse using pipelines.
- Develop Warehouse projects in Visual Studio Code: project creation, build, publish, deployment settings.
- Restore in-place of a Warehouse.
Ce contenu vous a-t-il été utile ?
Que pourrions-nous améliorer ?
Merci — cela m’aide à améliorer Javi Builds.
Continuer à apprendre
- Aide-mémoireDéboguer les pipelines FabricDiagnostiquer les échecs de pipelines Microsoft Fabric en isolant l’activité en échec, en distinguant les erreurs transitoires des erreurs déterministes, en validant les paramètres et les identités, et en utilisant les nouvelles tentatives, la journalisation et des relances maîtrisées en toute sécurité.Ouvrir l’aide-mémoire
- ArticleIntégration Git dans Microsoft Fabric : un workflow de développement pratiqueComment l’intégration Git de Fabric fonctionne vraiment au quotidien : espace de travail et branche, commit et mise à jour, branch out, pull requests, conflits, dérive et permissions.Lire l’article
Que devrais-je créer ensuite ?
Je développe Javi Builds autour des problèmes concrets rencontrés par les data engineers. Dites-moi quel sujet vous aimeriez voir ensuite.
Restez au courant
Recevez uniquement les nouvelles de Javi Builds qui vous intéressent.
Consultez votre boîte de réception
Je vous ai envoyé un lien de confirmation. Votre abonnement sera actif après confirmation.