Unlock Power BI and Fabric development: how to use any AI agent with Power BI today
Save the model as a Power BI Project and an AI agent can read and edit all of it. Ask for a measure, a format, an explanation. Ship it through one loop with a gate, know what goes wrong, and run the stack that makes the agent good.
Save the model as a Power BI Project and an AI agent can read every table, measure and relationship as text. Then you ask it in plain words, it edits the text, a gate script checks the files, and you read a diff of a few lines before anything merges.
This is how to use any AI agent with Power BI today. Videos 1 to 3 put the model in Git. Videos 4 to 7 are what you do with it once it is there: what the agent can do, the loop it runs in, what goes wrong, and the stack we run to make it good.
The series
Seven short videos, one playlist. Each answers one question.
| # | Unlock | Question |
|---|---|---|
| 1 | The file | How do I version control Power BI? |
| 2 | The history | Do I need Fabric capacity to use Git with Power BI? |
| 3 | The agent | How can an AI agent work on my Power BI model safely? |
| 4 | The cool things | How can I use AI to work on Power BI models? |
| 5 | The workflow | What is the workflow for AI in Power BI? |
| 6 | The gotchas | What can go wrong with AI in Power BI? |
| 7 | The stack | How can I make AI better at Power BI and Fabric? |
Videos 4 to 7 are on this page. Videos 1 to 3 have their own page, Git is step 0.
Why let AI near the model at all?
- A stakeholder asks for one measure. It takes a day to get to it, and 10 minutes to do.
- You inherit a model with 140 measures and no notes. Nobody knows which 30 are still used.
- Every number on a new report shows as 0.2345 because nobody set format strings.
- A column rename touches 40 visuals. You do it by hand, and miss 3.
- You tried an AI tool on the .pbix once. It could not open it.
One cause for all five: the model is locked in a binary file and the work is repetitive text edits. A Power BI Project is text. An agent reads text, and repetitive text edits are the thing it is best at.
How can I use AI to work on Power BI models?
Once the model is a Power BI Project in a folder, add that folder to any AI agent that can read files. On video it is the desktop app of the agent we use: add the folder, type the ask, read the diff in the app. No terminal for this part. The agent reads the TMDL (Tabular Model Definition Language) files the same way it reads source code. Things we ask for on real models, every week:
| Ask | What the agent edits | Size of the change |
|---|---|---|
| “Add a measure for average price with a currency format” | one table file, one measure block | 4 lines |
| “Give every measure a format string” | one line under each measure | 1 line per measure |
| “Explain this model in 5 lines” | nothing, it reads | 0 lines |
| “List measures and columns no visual uses” | nothing, it reads model and report | 0 lines |
“Rename cust_nm to customer_name in the model and every visual” |
the column, every measure that uses it, every visual JSON | 10 to 50 lines |
| “Point the source at the prod server” | the parameter in expressions.tmdl |
1 line |
| “Write a data dictionary from the model” | a new Markdown file | 1 file |
The two on video: the 5-line explanation of a model the agent has never seen, and format strings on 5 measures in one ask.
What makes this safe is not the agent. It is the next two sections.
What is the workflow for AI in Power BI?
One loop, the same one a person would use:
- Issue. The ask lives in a ticket, one sentence is enough. “margin shows 0.23, show it as 23%.”
- Branch. The agent makes a branch for that issue. Main never changes directly.
- Edit. The agent changes the text. For the ticket above: one line,
formatString: 0%, under one measure. - Gate. A script checks every file in the project before anyone looks at it. Blockers stop the loop here.
- Pull request. The agent opens it, with the gate result in the body.
- Review and merge. You read the diff. For this ticket: 1 file, 1 line. You merge, or you send it back.
The agent runs steps 2 to 5 in one go, in minutes. You own steps 1 and 6. On our own engagements the median pull request that touches a model changes 3 to 110 lines, so the review is a few minutes too.
Paste this into your AI coding agent from the project folder (Git already set up, see videos 1 to 3):
Work on this Power BI Project the following way, every time.
1. I give you an issue number or one sentence. Make a branch named feature/<issue>-<short-slug> off main.
2. Edit only the TMDL or report JSON files the change needs. Never edit the .pbip, .pbir, .platform or diagramLayout.json files, Power BI Desktop owns those.
3. Before you open a pull request, run the gate script (scripts/gate.py) on the project. If it reports a BLOCKER, fix it and run it again. Never open a pull request with a blocker.
4. Open the pull request with a 5 line body: what changed, why, the gate result, the files touched, how I can verify it in Desktop.
5. Never merge. Never push to main. Never run anything against a database. Stop and show me the diff.
What can go wrong with AI in Power BI?
Two kinds of failure, each with its own catch. Then one limit nobody has solved yet.
Bad text: the gate
The model files are text, so the agent can write text that looks right and still crashes Power BI Desktop on open. The four we hit most:
| Mistake | What happens | Gate check |
|---|---|---|
| Line endings changed from CRLF to LF | Desktop: “Invalid indentation” | crlf |
A /// comment in relationships.tmdl |
Desktop crash: “Property ‘description’ is unknown” | relationship-triple-slash |
| Auto date/time left on | Desktop rewrites every relationship on save | auto-date-time |
Two objects with the same lineageTag |
Model does not load | duplicate-lineage-tag |
Our gate runs 29 checks on every project. 12 of them are blockers and stop the pull request. The rest are standards and hygiene: a measure with no format string, a key column that is not hidden, a calculated column where a SQL column belongs. A committed baseline freezes old findings, so only new ones fail.
On video: the agent is asked for a /// comment on purpose. The gate reports the blocker, the agent reads the error, fixes the line, and the gate goes green. The person never opens Desktop.
Have your agent build the minimal gate. Paste this:
Write scripts/gate.py for this Power BI Project. It walks every .tmdl and .json file under the .SemanticModel and .Report folders and exits 1 on any of these, 0 otherwise. Print each finding as SEVERITY check-id file:line message.
BLOCKER crlf: a .tmdl file with LF line endings, or mixed endings.
BLOCKER relationship-triple-slash: a line starting with /// in relationships.tmdl.
BLOCKER auto-date-time: model.tmdl without the line annotation __PBI_TimeIntelligenceEnabled = 0.
BLOCKER duplicate-lineage-tag: the same lineageTag value on two objects anywhere in the model.
BLOCKER invalid-report-json: any .json file under .Report that does not parse.
STANDARD measure-no-format: a measure with no formatString line.
STANDARD key-not-hidden: a column whose name ends in _key or _id without isHidden.
Add a --baseline flag that reads baseline.json and reports only findings not in it, and --write-baseline to create that file. No third party packages.
Bad commands: the hooks
The second kind of failure is not in the files. It is a command the agent should never run: a DELETE against the source database, a push to main, a force push, merging its own pull request. A rule in a prompt is a suggestion. A hook is a wall.
Every AI coding agent worth using has a hook system: a script that runs before each command and can refuse it. Ours block five things before the command starts:
| Command | Hook result |
|---|---|
Any SQL write (INSERT, UPDATE, DELETE, DROP) |
blocked |
| Any database call without an approval marker from the human, reads included | blocked |
git push to main, force push, git clean, remote branch delete |
blocked |
| Approve or merge its own pull request | blocked, merge asks the human |
Edit .pbip, .pbir, .platform, diagramLayout.json |
blocked |
On video: “push this to main” and “delete the test rows in the sales table”. Both stop with the hook message on screen, before anything runs.
The agent can propose anything. It can ship nothing on its own.
The honest limit: no live edit inside Desktop
No agent edits a model live inside Power BI Desktop today. Copilot in Desktop writes a DAX measure or a visual on request. It does not run a loop: no branch, no gate, no pull request, no undo of its own change. The agent in this series works on the files between saves: you save and close Desktop, the agent edits, the gate runs, you reopen. It is one extra close and open per change. Against that: history, review, undo, and a gate. This is the way that works now, with any agent that reads files.
How can I make AI better at Power BI and Fabric?
Not a better model. A better setup. Give the agent text, rules, a gate, and a way to publish. This is our stack, five pieces, and the one we are building:
| # | Piece | What it does | Ours |
|---|---|---|---|
| 1 | The agent | reads the project, runs commands. The desktop app for asks, the terminal for the loop | any agent that runs commands and has hooks |
| 2 | Rules as text | our Power BI standard the agent reads every session: format strings, hidden keys, SQL-first partitions, no DAX calculated columns, auto date time off | one Markdown file, 230 lines, plus a DAX and a TMDL reference |
| 3 | The gate | the checks above, run before every pull request | 29 checks, 12 blockers |
| 4 | Hooks | the walls above, run before every command | 5 hooks |
| 5 | Publish from code | deploy the Power BI Project to a Fabric workspace from a script, no Publish button in Desktop | Microsoft’s fabric-cicd Python library |
| 6 | FabricSensei CLI | the gate, the tenant inventory and the publish as one tool, for anyone | the next series |
Other tools fit the same stack. One line each:
- Fabric CLI (
fab): Microsoft’s terminal for workspaces and items, so the agent can list and move Fabric items without the portal. - Tabular Editor: batch scripts and a best-practice analyzer on the model, the same idea as the gate, inside a desktop tool.
- TMDL extension for VS Code: syntax and folding for the files the agent edits, for the human reading the diff.
What matters is the shape: text, rules, gate, walls, publish. Any agent in piece 1, any tool in pieces 2 to 5, same result.
Result
Our own engagements, every model in Git, every change through the loop:
| Measure | Value |
|---|---|
| Merged pull requests with the gate result in the body | 70 |
| Gate checks per project | 29, 12 of them blockers |
| Hooks between the agent and anything irreversible | 5 |
| Rules the agent reads, lines | 230 standard + 111 DAX + 124 TMDL |
| Median lines changed per model pull request | 3 to 110 |
| Change in the video | 1 file, 1 line |
Videos
Videos 4 to 7 and their transcripts land here after the recording. Videos 1 to 3 are on the Git is step 0 page.
