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.

Get the project

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

Flow from the dev workspace through a feature branch and a pull request to main, then a GitHub Actions workflow that runs fabric-cicd into the test workspace first and, after approval, into the prod workspace.

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.

  1. 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.

  2. 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 (here fabric) 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.

  3. Work through branches and pull requests. Commit from the Source control pane. If main does not allow direct commits, use Commit to new branch and open a pull request. Items land in folders named <Name>.<ItemType>, for example LoadSales.Notebook. Microsoft’s best-practices article connects the dev workspace to main and uses Git synchronization, not fabric-cicd, to bring merged changes back into dev.

  4. 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. Each find_value below is the dev value, and each replace_value is 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.$id is the ID of the target workspace. $items.Lakehouse.Sales.$id is the ID of the lakehouse called Sales in 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).

  5. Write the deployment script. fabric-cicd needs a credential object. The documentation’s GitHub example uses AzureCliCredential after an azure/login step. unpublish_all_orphan_items is 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_items creates 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).

  6. 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_ID and AZURE_TENANT_ID as secrets and the workspace ID as a variable of each GitHub Environment (test, prod). In the repository settings, add required reviewers to prod.

    # 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: PROD
    

    The action versions were checked on 2026-11-29 against each action’s own repository: actions/checkout 7.0.1 (the v7 tag), actions/setup-python 7.1.0 (v7) and azure/login 3.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.

  7. Check the repository before anything is sent. The project’s check_repo.py runs offline. It checks the folder names and .platform files, validates parameter.yml for each environment with fabric-cicd’s own validator, lists GUIDs in items that parameter.yml does not cover, and flags actions that point to a branch instead of a version tag or a commit SHA (a tag such as v7 can still be moved; --require-sha rejects tags too), a missing id-token: write and 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.

  8. Dry-run, then deploy. python deploy.py --dry-run sends 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.

Terminal output: the dry run lists three items it would publish and shows orphan deletion off; the checker reports five problems on a copy with four deliberate mistakes; 14 tests pass.

Real output of the project, fabric-cicd 1.4.0, 2026-11-29. Library log lines left out; long lines wrapped.

The project

Get 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.py on the sample repository: all checks passed.
  • deploy.py --dry-run: three items listed, orphan deletion off.
  • check_repo.py on 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_items removes 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 their enable_*_unpublish flag is set. Deleted items go to the workspace recycle bin by default. Types without soft delete need enable_hard_delete. The function accepts an exclusion regex for item names. The Fabric CLI fab deploy unpublishes 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.yml is 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_publish feature 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 deploy configuration. The Pattern uses the default fabric-cicd publish mode.

Sources

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.

Portrait of Rodrigo Lombana Reina

Rodrigo Lombana Reina, data engineer. Data problems solved, step by step.

About Rodrigo · The opinions and texts on this site are my own.

My LinkedIn profile