Deploy Fabric items from GitHub to test and prod
Connect the dev workspace to GitHub with Fabric Git integration. Then a GitHub Actions workflow runs the fabric-cicd Python library to publish the repository's item definitions into test and prod, signing in as a service principal over OIDC. Swap environment IDs with parameter.yml, and keep orphan deletion off until you have reviewed what it would remove.
Data engineers · ·
The problem
You build in the Fabric portal and then rebuild the same notebooks and pipelines by hand in test and prod. Nobody can say what changed, or who changed it, and the lakehouse IDs differ in every workspace. This Pattern is for data engineers who want items in Git, changes through pull requests, and the same files promoted in order.
Steps
One set of files, promoted in order. Git integration keeps dev in sync with main; the workflow does the promotion.
Complete steps 1 to 3 in Fabric and GitHub. For steps 4 to 8, follow along with the sample project below.
-
Switch on Git integration for GitHub. A tenant admin enables “Users can synchronize workspace items with their Git repositories” and, for GitHub, the separate GitHub switch under OneLake catalog > Govern > Configurations > Tenant settings. The admin page calls the second one “Users can sync workspace items with GitHub repositories” and says it is disabled by default; the first is enabled by default. You also need a Fabric capacity.
-
Connect the dev workspace to
main. A workspace admin opens Workspace settings > Git integration, picks GitHub, adds an account with a personal access token, then chooses repository, branch and folder (herefabric) and selects Connect and sync. Microsoft recommends a fine-grained token with Contents read and write. Each person who works in the workspace should add their own connection and not share one token. If both the workspace and the branch already have content, Fabric asks which direction to sync, and updating the workspace from Git overwrites workspace content. -
Work through branches and pull requests. Commit from the Source control pane. If
maindoes not allow direct commits, use Commit to new branch and open a pull request. Items land in folders named<Name>.<ItemType>, for exampleLoadSales.Notebook. Microsoft’s best-practices article connects the dev workspace tomainand uses Git synchronization, not fabric-cicd, to bring merged changes back into dev. -
Put the environment-specific IDs in
parameter.yml. The file sits in the root of the folder you deploy, next to the item folders. A notebook committed from dev carries the dev lakehouse and workspace GUIDs. Eachfind_valuebelow is the dev value, and eachreplace_valueis looked up by the environment name you pass to the deployment.find_replace: - find_value: "11111111-1111-1111-1111-111111111111" # dev lakehouse id as committed in the notebook replace_value: TEST: "$items.Lakehouse.Sales.$id" PROD: "$items.Lakehouse.Sales.$id" item_type: "Notebook" - find_value: "22222222-2222-2222-2222-222222222222" # dev workspace id as committed in the notebook replace_value: TEST: "$workspace.$id" PROD: "$workspace.$id" item_type: "Notebook"$workspace.$idis the ID of the target workspace.$items.Lakehouse.Sales.$idis the ID of the lakehouse calledSalesin the target workspace. The GUIDs here are placeholders. If the environment name you pass is not a key in the file, fabric-cicd 1.4.0 logs a warning and skips the replacement. The project’s checker turns that into an error (step 7). -
Write the deployment script. fabric-cicd needs a credential object. The documentation’s GitHub example uses
AzureCliCredentialafter anazure/loginstep.unpublish_all_orphan_itemsis called only when you ask for it.# Adapted from the fabric-cicd authentication example for GitHub. from azure.identity import AzureCliCredential from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items workspace = FabricWorkspace( workspace_id=workspace_id, # from the WORKSPACE_ID variable of the GitHub Environment environment=environment, # TEST or PROD, a key in parameter.yml repository_directory="fabric", item_type_in_scope=["Lakehouse", "Notebook", "DataPipeline"], token_credential=AzureCliCredential(), ) publish_all_items(workspace) if unpublish_orphans: # off unless you pass --unpublish-orphans unpublish_all_orphan_items(workspace)publish_all_itemscreates or updates every item of the in-scope types on each run. It does not compare commits. Removing items that are no longer in the repository is a separate call, and it deserves its own care (see Limits). -
Create the identity and the workflow. Create a Microsoft Entra app registration with a federated credential that trusts your repository (setup is in the Azure Login documentation), enable the tenant setting that lets service principals use Fabric APIs, and add the service principal to each target workspace. Microsoft’s Azure DevOps tutorial uses Member or Admin. Store
AZURE_CLIENT_IDandAZURE_TENANT_IDas secrets and the workspace ID as a variable of each GitHub Environment (test,prod). In the repository settings, add required reviewers toprod.# Based on the azure/login and fabric-cicd documentation. name: deploy-fabric on: push: branches: [main] permissions: id-token: write # needed by azure/login to request an OIDC token contents: read jobs: deploy-test: runs-on: ubuntu-latest environment: test # GitHub Environment; holds the test variables and secrets steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.12" - run: pip install -r requirements.txt - run: python check_repo.py - uses: azure/login@v3 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} allow-no-subscriptions: true - run: python deploy.py env: WORKSPACE_ID: ${{ vars.FABRIC_WORKSPACE_ID }} ENVIRONMENT: TEST deploy-prod: needs: deploy-test runs-on: ubuntu-latest environment: prod # add required reviewers to this environment in the repository settings steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.12" - run: pip install -r requirements.txt - run: python check_repo.py - uses: azure/login@v3 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} allow-no-subscriptions: true - run: python deploy.py env: WORKSPACE_ID: ${{ vars.FABRIC_WORKSPACE_ID }} ENVIRONMENT: PRODThe action versions were checked on 2026-11-29 against each action’s own repository:
actions/checkout7.0.1 (thev7tag),actions/setup-python7.1.0 (v7) andazure/login3.1.0 (v3). The fabric-cicd documentation still shows older majors in its examples. A job that targets an environment with required reviewers waits for approval before it can read that environment’s secrets. -
Check the repository before anything is sent. The project’s
check_repo.pyruns offline. It checks the folder names and.platformfiles, validatesparameter.ymlfor each environment with fabric-cicd’s own validator, lists GUIDs in items thatparameter.ymldoes not cover, and flags actions that point to a branch instead of a version tag or a commit SHA (a tag such asv7can still be moved;--require-sharejects tags too), a missingid-token: writeand literal secrets. On a copy with four deliberate mistakes it reported five problems, among them the missing environment value that the library alone only warns about. The recorded output is in the image below. -
Dry-run, then deploy.
python deploy.py --dry-runsends nothing and needs no sign-in. It lists the item folders it would publish and states that orphan deletion is off. After a real deployment, open the target workspace and check that the items exist, and that a notebook’s default lakehouse is the one in that workspace and not the dev one.
Real output of the project, fabric-cicd 1.4.0, 2026-11-29. Library log lines left out; long lines wrapped.
The project
fabric-github-deploy is a small Python project with synthetic data. It holds three hand-written stand-in items, parameter.yml, deploy.py with a dry run, check_repo.py, the workflow above and 14 tests. The stand-in items were not exported from Fabric.
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python check_repo.py && python deploy.py --dry-run && python -m pytest
What the recorded run showed (full output in RUN_LOG.txt inside the project):
check_repo.pyon the sample repository: all checks passed.deploy.py --dry-run: three items listed, orphan deletion off.check_repo.pyon a copy with four deliberate mistakes: five problems reported.- 14 tests passed. The two calls that talk to Fabric are replaced by fakes in the tests, so the tests prove the flag logic and the checks, not a deployment.
check_repo.py imports validate_parameter_file from a private module of fabric-cicd, the function Microsoft’s own debug script for parameter.yml calls. Pin the version, as the project does.
Copy this prompt
When preparing deployment for your own Fabric repository, paste this into your coding assistant and give it the folder, item types and target environments. Ask for a workflow and parameter.yml draft with a dry run that lists what would be published before you deploy anything.
Write a fabric-cicd deployment for a repository folder <folder> that holds
<item types>. Authenticate with AzureCliCredential after an azure/login OIDC step.
Take the workspace ID and the environment name from environment variables.
Use parameter.yml with find_replace entries for the dev lakehouse and workspace
GUIDs, with keys for <environments>. Do not call unpublish_all_orphan_items
unless a flag is passed. Add a dry-run mode that sends nothing and lists what
would be published. Pin every GitHub Action to a version you have checked in
that action's own repository, and say which ones you could not check.
Check the answer for four things: no secret in the YAML, id-token: write, a parameter.yml key for every environment, and orphan deletion behind a flag.
Test result
The local dry run listed what would be published and validated parameter.yml. Compare that output with your dry run before deploying to the target environment.
Limits
- Orphan deletion is destructive.
unpublish_all_orphan_itemsremoves items of the in-scope types that are missing from the repository. The fabric-cicd documentation says Lakehouses, Warehouses and several other types are deleted only when theirenable_*_unpublishflag is set. Deleted items go to the workspace recycle bin by default. Types without soft delete needenable_hard_delete. The function accepts an exclusion regex for item names. The Fabric CLIfab deployunpublishes by default, so read its prompt. - A wrong environment name skips the replacement. The deployment still runs and dev IDs reach test. The library logs a warning and nothing more.
- Hardcoded GUIDs. Any GUID in an item that is not in
parameter.ymlis deployed as it is. The checker finds GUIDs, but it cannot tell which ones you meant to replace. - Full deployment on every run. Documentation: each run publishes without comparing commit diffs. Only items with source control and public create and update APIs are supported.
- Not everything is Git-supported. Unsupported items in the folder are ignored by Git integration. Several item types are marked preview on the Learn overview.
- Shortcuts are opt-in. Deploying shortcuts with a Lakehouse needs the
enable_shortcut_publishfeature flag. - The Git connection to GitHub is personal. Fabric connects with a user’s personal access token, and Learn says each person should configure their own connection. The service principal in this Pattern deploys; it does not own the Git connection. Rotate tokens, and keep secrets out of the repository.
- Size limits. The combined size of files in one commit from Fabric to GitHub is limited to 50 MB, and a workspace holds at most 1,000 items.
- Branch switching overwrites. Switching the connected branch replaces all items in the workspace with the content of the new branch.
- Required reviewers depend on your GitHub plan. GitHub’s documentation says organisations on GitHub Team and users on GitHub Pro can configure environments for private repositories. Check your plan before you rely on the approval gate.
- Not covered. Fabric deployment pipelines, deployment plans (preview on Learn), the Bulk Import Item Definitions API and
fab deployconfiguration. The Pattern uses the default fabric-cicd publish mode.
Sources
- Get started with Git integration, accessed 2026-11-29
- Basic concepts in Git integration, accessed 2026-11-29
- What is Microsoft Fabric Git integration?, accessed 2026-11-29
- Git integration tenant settings, accessed 2026-11-29
- Fabric CI/CD concepts and best practices, accessed 2026-11-29
- What is CI/CD in Microsoft Fabric?, accessed 2026-11-29
- Tutorial: Local deployment, accessed 2026-11-29
- Tutorial: CI/CD for Fabric with Azure DevOps and fabric-cicd, accessed 2026-11-29
- Identity support in Fabric REST APIs, accessed 2026-11-29
- fabric-cicd documentation, accessed 2026-11-29
- fabric-cicd: Getting started, accessed 2026-11-29
- fabric-cicd: Parameterization, accessed 2026-11-29
- fabric-cicd: Optional features, accessed 2026-11-29
- fabric-cicd: Authentication examples, accessed 2026-11-29
- fabric-cicd release v1.4.0, accessed 2026-11-29
- fabric-cicd on PyPI, accessed 2026-11-29
- azure/login (README), accessed 2026-11-29
- actions/checkout releases, accessed 2026-11-29
- actions/setup-python releases, accessed 2026-11-29
- Authenticate to Azure from GitHub Actions by OpenID Connect, accessed 2026-11-29
- GitHub Docs: Managing environments for deployment, accessed 2026-11-29
Author
Rodrigo Lombana Reina, data engineer. Personal opinions. Checked against the documentation on 2026-11-29.
Questions
How do I deploy Microsoft Fabric items from GitHub?
Connect the dev workspace to a GitHub branch with Fabric Git integration, merge changes by pull request, then run a GitHub Actions workflow that calls fabric-cicd 1.4.0. It publishes the item folders in the repository to the target workspace, replacing environment-specific IDs from parameter.yml. The workflow section shows the file; it was not executed against a tenant.
What is fabric-cicd?
fabric-cicd is an open-source Python library, latest release 1.4.0 on 2026-10-07, that publishes Fabric item definitions from a source-controlled folder to a workspace through the Fabric REST APIs. Microsoft Learn states the Fabric product team officially supports and recommends it. Each run is a full deployment of the item types you put in scope, not a diff.
Should I use fabric-cicd or the Fabric CLI fab deploy command?
Either works, because fab deploy runs fabric-cicd underneath. Choose fab deploy if you prefer a YAML config and no Python. Choose the library if you want logic around the deployment, such as the checks in the project below. Note the difference in the Microsoft tutorial: fab deploy also unpublishes items that no longer exist in the source.
What does unpublish_all_orphan_items delete?
It removes workspace items of the in-scope types that are not in the repository. In fabric-cicd 1.4.0 the documentation says Lakehouses, Warehouses and some other types are only deleted when their own enable_*_unpublish feature flag is set. Deleted items go to the recycle bin by default. Review what is in the target workspace before you call it, and never run it first against prod.
Why do my notebooks point to the wrong lakehouse after deployment?
Because the notebook definition contains the dev workspace and lakehouse GUIDs, for example in the default lakehouse metadata. Microsoft's tutorial calls these hardcoded GUIDs. Replace them at deploy time with find_replace entries in parameter.yml and the variables $workspace.$id and $items.Lakehouse.<name>.$id, and pass an environment name that exists in that file.
How should GitHub Actions authenticate to Fabric?
Sign in with azure/login v3 using OpenID Connect and a service principal, then let fabric-cicd use AzureCliCredential. The Azure Login documentation recommends OIDC and needs id-token: write. The service principal also needs the tenant setting that lets service principals use Fabric APIs, plus a role on each target workspace. Fabric's own connection to GitHub still uses a personal access token.
Is Fabric Git integration with GitHub generally available?
Microsoft Learn lists GitHub as a supported provider and shows no preview label on the admin settings page, but the getting-started page still links to those switches by anchors ending in preview, and several item types are marked preview. No dated general-availability announcement for GitHub was found on 2026-11-29. Check the item type you use.
What can fabric-cicd not deploy?
It supports only items that have source control and public create and update APIs. The fabric-cicd documentation lists 31 item types, among them Lakehouse, Notebook, DataPipeline, SemanticModel and Report. Other items are not supported. Shortcuts need the enable_shortcut_publish feature flag. Bulk publish mode is experimental, so this Pattern uses the default mode.
