Ship It Safe · Ep 2/8: Designing a Power BI pipeline that can say no
Which failures should block a Power BI release and which should only warn: a two-gate design with Tabular Editor BPA, fabric-cicd and a refresh check.
Last episode: releasing Power BI without gates is a gamble. When Publish is the release process, nothing checks a semantic model between your laptop and the people who read it. Today: the design of the pipeline we'll build over the next six episodes, and the one decision that shapes it.
Who this is for
Power BI and Fabric developers who keep (or are about to keep) their models in PBIP and Git and want a release process that can stop a bad change, without turning into a gate everyone learns to bypass.
The decision that matters most
Most CI/CD discussions start with the tool: Azure DevOps or GitHub Actions. Both can run everything in this series, so I'll leave that choice for later. The decision that shapes the pipeline is which failures are allowed to block a release, and which only warn.
I learned that the slow way. In September 2026 I moved my first report to PBIP, TMDL and Git, wrapped in a set of validation rules meant to catch problems before deployment. The rules flagged things that weren't problems and missed some that were. A rule set like that can't be allowed to block anything yet: block on noise and people stop trusting the gate, then they start going around it.
So the design separates two questions for every check:
- Where does it run? On the pull request, during deploy, or after deploy.
- What happens when it fails? Block (the change doesn't move on) or warn (it's visible, nothing stops).
The design: two gates around one deploy step

| Stage | Check | Fails how | Blocks? |
|---|---|---|---|
| Pull request | Tabular Editor Best Practice Analyzer on the semantic model | Rule at severity 3 or higher → error → exit code 1 | Yes (required check) |
| Pull request | Same, severity 2 | Warning in the build log | No |
| Deploy | fabric-cicd publishes the PBIP to the target workspace | Script exits non-zero | Yes (the stage fails) |
| After deploy | Refresh the model, read its refresh history | Status Failed |
Yes (no promotion) |
| Later | Data tests (Ep 5), rollback (Ep 7) |
What I reuse, and credit: Tabular Editor's Best Practice Analyzer for the rules, fabric-cicd for deployment, the Power BI REST API for the refresh check, and Microsoft's own PBIP build pipeline sample, which already shows the PR gate in Azure DevOps. What the series adds is a Test stage between Dev and Prod, data tests (Ep 5) and rollback (Ep 7), wired into one pipeline.
Step 1: make the PR build a gate that can say no
The Best Practice Analyzer decides how a rule violation is reported by the rule's severity. From the Tabular Editor 2 command-line documentation:
- Severity 1 is informational only
- Severity 2 causes a WARNING
- Severity 3 or higher causes an ERROR, and if any error-level output is encountered, Tabular Editor returns exit code 1
An exit code alone doesn't stop anything. The build has to be a required check on the branch you release from:
- Azure DevOps: add the validation pipeline as a build policy on
main. Microsoft's PBIP sample describes the effect: with a high-severity error, "you can't finalize the pull request and merge the changes back into the main branch." - GitHub: protect
mainand require the status check; GitHub's rule is that "all required status checks must pass before collaborators can merge changes into the protected branch."
Ep 4 builds this gate end to end, including the rule file.
The warn-first rule
Every new rule starts at severity 2. It runs on real pull requests, and someone reads what it flags. It moves to severity 3 only when it has stopped flagging non-issues. This is the part of the design I care about most, because my September rules are exactly the kind that shouldn't have been allowed to block.
Step 2: deploy with fabric-cicd and let a failure stop the stage
fabric-cicd is described on Microsoft Learn as "an officially supported, Microsoft-backed open-source Python library" for deploying Fabric items, including PBIP semantic models and reports, from source control to workspaces. The deploy script from that page is short:
import argparse
from azure.identity import InteractiveBrowserCredential, AzureCliCredential
from fabric_cicd import FabricWorkspace, publish_all_items
parser = argparse.ArgumentParser(description="Deploy PBIP to Fabric")
parser.add_argument("--workspace_name", type=str, required=False, help="Target workspace name", default="PBIP Fabric CICD Dev")
parser.add_argument("--environment", type=str, default="dev", help="Environment name")
parser.add_argument("--spn-auth", action="store_true", help="Use SPN authentication via Azure CLI")
args = parser.parse_args()
# Use InteractiveBrowserCredential for local development, AzureCliCredential for CI/CD pipelines
if not args.spn_auth:
credential = InteractiveBrowserCredential()
else:
credential = AzureCliCredential()
workspace_params = {
"workspace_name": args.workspace_name,
"environment": args.environment,
"repository_directory": ".",
"item_type_in_scope": ["SemanticModel", "Report"],
"token_credential": credential,
}
target_workspace = FabricWorkspace(**workspace_params)
publish_all_items(target_workspace)Environment differences live in parameter.yml, which fabric-cicd reads before it deploys: it finds each find_value in the PBIP definition files and swaps in the value for the target environment. This is the first entry of the Learn example (the second does the same for a lakehouse ID):
find_replace:
# Replace workspace ID for DirectLake connection
- find_value: "11111111-1111-1111-1111-111111111111"
replace_value:
dev: "11111111-1111-1111-1111-111111111111" # Dev workspace
prod: "22222222-2222-2222-2222-222222222222" # Prod workspaceThe pipeline step on the same Learn page ends with an exit-code guard, which is what turns a failed deploy into a failed stage:
python -u deploy.py --spn-auth --workspace_name "$workspace_name" --environment "$environment"
if ($LASTEXITCODE -ne 0) {
Write-Error "Deployment failed with exit code: $LASTEXITCODE"
exit $LASTEXITCODE
}Microsoft's example maps two branches to two workspaces (dev and prod). This series adds a Test stage between them; Ep 6 covers the promotion.
Step 3: check the refresh before anything is promoted
A model can deploy cleanly and still fail its first refresh, for example when a connection string or credential is wrong in the new workspace. So after deploy, the pipeline refreshes the model and reads its refresh history. The REST API documents the statuses: Unknown while a refresh is in progress, Completed for success, Failed for an unsuccessful refresh (with the error code in serviceExceptionJson).
Here's the shape of that check as a sketch (Ep 7 hardens it):
import sys
import time
import requests
from azure.identity import AzureCliCredential
workspace_id, dataset_id = sys.argv[1], sys.argv[2]
base = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/datasets/{dataset_id}"
token = AzureCliCredential().get_token("https://analysis.windows.net/powerbi/api/.default").token
headers = {"Authorization": f"Bearer {token}"}
# Trigger a refresh (the API answers 202 Accepted).
# notifyOption isn't applicable when a service principal calls the API, so the body stays empty.
requests.post(f"{base}/refreshes", headers=headers, json={}).raise_for_status()
# Poll the latest entry in the refresh history
for _ in range(60): # about 30 minutes
time.sleep(30)
latest = requests.get(f"{base}/refreshes?$top=1", headers=headers).json()["value"][0]
if latest["status"] == "Completed":
print("Refresh completed")
sys.exit(0)
if latest["status"] != "Unknown": # Failed, or Disabled by a selective refresh
print("Refresh did not complete:", latest["status"], latest.get("serviceExceptionJson"))
sys.exit(1)
print("Refresh still running after 30 minutes")
sys.exit(1)The script takes the IDs of the target workspace and semantic model as arguments. A non-zero exit fails the stage, so the model doesn't move to the next environment.
Gotchas and limits
- A gate is only as good as its rules. That's why rules start as warnings. Promote them one at a time.
$top=1can pick up the wrong refresh. If a scheduled refresh starts in the same window, the newest history entry may not be yours. The trigger call returns aLocationheader pointing at the refresh it started; Ep 7 uses that instead.- Shared capacity limits. On shared capacity the refresh API allows at most eight requests per day, scheduled refreshes included, so a refresh check on every deploy can run out of budget.
- First deploy needs a human. The first time a semantic model with data sources is deployed with fabric-cicd, the data source credentials have to be configured in the Fabric portal.
- Community tools. Microsoft's PBIP sample notes that the community tools it uses are third-party and that Microsoft doesn't support or document them.
- This is a design. I've designed the Dev/Test/Prod promotion and planned the gates; none of this has run in production yet. The build episodes report what happens when each piece runs.
What to check in your own setup
- Is the validation build a required check on the branch you release from, or does it only report?
- Which of your rules would you trust to block today? Those go to severity 3; everything else stays at 2.
- Does a failed deploy fail the stage, or does the pipeline carry on?
- Does anything look at the first refresh in the target workspace before people do?
Summary
Pick the CI tool last. First decide what is allowed to say no: rules you trust block the pull request, a failed deploy stops the stage, a failed refresh stops promotion, and every new rule earns its right to block.
Next (Tuesday, Ep 3): PBIP + Git, making a model reviewable.
Sources
Checked 5 November 2026.
- Tabular Editor 2, Command line (updated 9 June 2026): BPA severity levels and exit codes.
- Microsoft Learn, PBIP and Azure DevOps build pipelines for validation (updated 15 December 2025).
- Microsoft Learn, Deploy Power BI projects (PBIP) using fabric-cicd (updated 18 September 2026): deploy.py, parameter.yml and the pipeline step quoted above.
- Power BI REST API, Refresh Dataset In Group (updated 25 March 2025) and Get Refresh History In Group (updated 25 January 2026).
- Microsoft Learn, Execute DAX Queries quickstart (updated 7 May 2026): the Power BI API scope.
- GitHub Docs, About protected branches.