AI Agents on Power BI Files: What Data They Can See

TOOLS Published 12 mins read By Leon Wei
AI Agents on Power BI Files: What Data They Can See cover image

Quick summary

Summarize this blog with AI

An AI coding agent can see every file in the folder you open, and whatever it reads, including the results of any DAX query it runs, goes into the prompt sent to the model provider. In a Power BI Project (PBIP), most files are metadata. But .pbi/cache.abf holds a full copy of the imported data, and report files can contain real values from filters, slicers and bookmarks. A PBIX file contains the data as well. Give the agent a copy that leaves out those files, keep the Modeling MCP server read-only unless you need writes, and get your compliance team's answer before any regulated data such as PHI is involved.

What was tested: I built a synthetic PBIP folder by hand, matching the layout in Microsoft Learn, and ran the Python 3.11 scanner and copy scripts below against it. I also checked the default .gitignore in a throwaway Git repository. Power BI Desktop is not available in this environment, so neither Desktop nor the MCP server was run. Their behavior described here comes from the Microsoft Learn PBIP pages, the Learn pages for the Power BI MCP servers and the server's GitHub README, all read on 2026-11-23. None of this is legal advice. Your organization's policy and your AI vendor's data terms decide what you are allowed to do.

What an agent can actually see

Agent tools reach your data in two different ways, and each has its own risk.

  • File access. Claude Code, GitHub Copilot agent mode and similar tools read files in the folder you open. A file the agent reads, in full or in part, becomes part of the conversation sent to the model provider. Being in .gitignore does not stop an agent from reading a file. It only stops Git from committing it.
  • Live model access through MCP. An MCP server connected to a semantic model lets the agent list tables, read measure definitions and run DAX queries. The Microsoft Learn overview of the Power BI MCP servers is direct about this: metadata, schemas and query results go to the MCP client, and the client might forward them to the configured LLM provider. Learn adds that this data movement is governed by your organization's AI data-handling policies and the provider's terms, "not through Power BI security controls alone."

The phrase "does not expand data access" in Microsoft's documentation is accurate, but people often read too much into it. The agent can't see anything you can't see. Anything you can see, though, it can read and send.

PBIP file inventory: data or metadata?

When you save as a project, Power BI Desktop writes a <name>.Report folder, a <name>.SemanticModel folder, a .pbip pointer file and a .gitignore. The table maps the files described in Microsoft Learn to what they can contain.

File or folderWhat it holdsCan it contain real data values?
SemanticModel/.pbi/cache.abfAn Analysis Services backup file. Learn describes it as a local cached copy of the model and data from when the model was last edited.Yes: every imported table.
*.pbix anywhere in the folderThe single-file format, which includes the imported data.Yes.
.pbi/localSettings.json (model and report)Settings that apply only to the current user and computer.Not designed to hold data. Keep it local anyway.
SemanticModel/definition/ (TMDL) or model.bimTables, columns, measures, relationships, roles and Power Query (M) expressions.Sometimes. Server names, database names and file paths appear in plain text. Tables created with Enter data keep their rows inside the M expression as an encoded string. Hard-coded values in DAX or M also show up here, such as an RLS rule that names a user or a filter on a specific customer.
SemanticModel/DAXQueries/*.daxSaved DAX query view tabs.Yes, if someone typed a literal value, such as a patient name, into a query.
SemanticModel/.pbi/unappliedChanges.jsonPower Query edits saved with Apply later.The same as M expressions. Git tracks this file by default.
Report/definition/ (PBIR: visual.json, page.json, *.bookmark.json, report.json)Pages, visuals, filters and bookmarks.Yes. Learn warns that these files "can be saved with data values from your semantic model". Its example is a filter of 'Company' = 'Contoso'. Slicer selections and series-specific formatting are stored the same way.
Report/StaticResources/RegisteredResources/Themes, images and private custom visuals.Images can show anything, such as a screenshot or a logo.
definition.pbism, definition.pbir, .pbip, .platformPointers and format versions. definition.pbir can hold a workspace connection string.No row data. They may name workspaces and models.

The default .gitignore that Desktop writes has exactly two lines. Desktop creates it only if no .gitignore already exists in the folder or in a parent Git repository:

**/.pbi/localSettings.json
**/.pbi/cache.abf

It does not cover a stray PBIX file. In the test repository, git add -A skipped cache.abf and both localSettings.json files, but it staged Old_copy.pbix and every report file that contained a filter value.

Scan a PBIP folder before you share it

This script lists every file and flags the ones that are likely to hold data. It uses only the Python standard library and makes no changes. It is a heuristic for finding files to review, not a guarantee that a folder is clean.

"""List files in a PBIP folder and flag ones likely to hold data values."""
import re
import sys
from pathlib import Path

PATTERNS = [
    (re.compile(r'"Literal"\s*:\s*\{\s*"Value"\s*:\s*"\'[^"]+'), "literal text value (filter, slicer or bookmark)"),
    (re.compile(r"Binary\.FromText\("), "embedded rows (Enter data table)"),
    (re.compile(r"#table\("), "inline table rows in M"),
    (re.compile(r'(Sql\.Database|Snowflake\.Databases|Odbc\.DataSource)\("([^"]+)"'), "server or account name"),
    (re.compile(r"(?i)(password|pwd|secret|accountkey|apikey)\s*[=:]"), "possible credential"),
]

def scan(root: Path):
    for path in sorted(p for p in root.rglob("*") if p.is_file()):
        flags = []
        if path.name == "cache.abf":
            flags.append("DATA: imported data (Analysis Services backup)")
        elif path.suffix.lower() == ".pbix":
            flags.append("DATA: PBIX package includes imported data")
        elif path.name == "localSettings.json":
            flags.append("LOCAL: per-user, per-machine settings")
        else:
            text = path.read_text(encoding="utf-8", errors="ignore")
            flags += ["REVIEW: " + label for rx, label in PATTERNS if rx.search(text)]
            if path.suffix.lower() == ".dax" and re.search(r'"[^"\n]{3,}"', text):
                flags.append("REVIEW: string literal in saved DAX query")
        print(f"{'!!' if flags else '  '} {path.relative_to(root)}")
        for f in flags:
            print(f"     -> {f}")

if __name__ == "__main__":
    scan(Path(sys.argv[1]))

Run it against the project folder with python3 pbip_scan.py path/to/ProjectFolder. On the synthetic clinic project, it printed:

   .gitignore
!! ClinicVisits.Report/.pbi/localSettings.json
     -> LOCAL: per-user, per-machine settings
!! ClinicVisits.Report/definition/bookmarks/bm1.bookmark.json
     -> REVIEW: literal text value (filter, slicer or bookmark)
   ClinicVisits.Report/definition/pages/p1/page.json
!! ClinicVisits.Report/definition/pages/p1/visuals/v1/visual.json
     -> REVIEW: literal text value (filter, slicer or bookmark)
!! ClinicVisits.SemanticModel/.pbi/cache.abf
     -> DATA: imported data (Analysis Services backup)
!! ClinicVisits.SemanticModel/.pbi/localSettings.json
     -> LOCAL: per-user, per-machine settings
!! ClinicVisits.SemanticModel/DAXQueries/Check.dax
     -> REVIEW: string literal in saved DAX query
!! ClinicVisits.SemanticModel/definition/tables/Targets.tmdl
     -> REVIEW: embedded rows (Enter data table)
!! ClinicVisits.SemanticModel/definition/tables/Visits.tmdl
     -> REVIEW: server or account name
   ClinicVisits.SemanticModel/definition.pbism
   ClinicVisits.pbip
!! Old_copy.pbix
     -> DATA: PBIX package includes imported data

Open each REVIEW file and check it. In this example, visual.json contains a visual filter on a patient name, which is exactly the kind of value that is easy to forget.

Give the agent a stripped copy, not your working folder

Don't point the agent at the folder you publish from. Make a copy that leaves out data files and per-machine files:

import shutil
import sys
from pathlib import Path

SKIP = {"cache.abf", "localSettings.json"}

def ignore(_dir, names):
    return [n for n in names if n in SKIP or n.lower().endswith(".pbix")]

shutil.copytree(Path(sys.argv[1]), Path(sys.argv[2]), ignore=ignore)

In the test, a second scan of the copy listed no DATA or LOCAL lines. The REVIEW lines remained, because removing the cache does not remove the filter values in report files. Clear those filters, slicers and bookmarks in Desktop on the copy, or replace the values with synthetic ones, and then scan again.

Learn notes that Desktop can open a project with no cache.abf. It then opens the full model definition without data. That is a good state for an agent to work in. When you need data to test measures, point the copy at a sample or synthetic source instead of production. Another option is a Power Query parameter, such as a row cap or a date range, that the copy uses to load only a small, approved slice. Remember that whatever that slice contains can still reach the model provider.

When you're done, bring changes back into your real project as a reviewed diff. Use git diff on the TMDL and PBIR files and read every changed line before you apply it. Don't copy the agent's folder over your own.

Block reads in the agent as well

Most agents have their own deny lists. In Claude Code, permission rules in .claude/settings.json use gitignore-style patterns:

{
  "permissions": {
    "deny": [
      "Read(**/.pbi/cache.abf)",
      "Read(**/.pbi/localSettings.json)",
      "Read(**/*.pbix)",
      "Read(./.env)"
    ]
  }
}

Claude Code's documentation says that Read deny rules apply to its built-in file tools and to shell commands it recognizes, such as cat and head. They don't apply to a recursive grep, or to a script that opens files itself. Treat these rules as a second layer, and keep relying on the stripped copy.

The Power BI Modeling MCP server: what it can do

Microsoft's local server is in the microsoft/powerbi-modeling-mcp repository. Learn now calls it the Power BI Authoring MCP server. The local version is generally available, and a hosted version is in preview. According to its Learn page and README:

  • The local server runs on your machine over stdio. It can connect to a model open in Power BI Desktop, to a semantic model in a Fabric workspace, or to a PBIP definition folder. It does not support macOS.
  • It includes DAX query tools that "execute and validate DAX queries against the model", with a hard limit of 100,000 rows per query. Those rows can go to your LLM provider. With only Build permission on a workspace model, the server can still run DAX queries.
  • --readonly is a safe mode that "prevents any write operations". The default, --readwrite, asks for confirmation before applying an edit to the semantic model, once per database. The README lists no option to skip that confirmation.
  • It can't edit report pages or diagram layouts. It works only on the model.
  • No tenant setting blocks the local server. The only way to block it is to disable the XMLA endpoint, which also blocks every other XMLA tool. Fabric audit logs record activity from the hosted server, not from the local one. The local server accepts --audit-log-path to write its own log.

Read-only mode stops writes. It does not stop reads, so a read-only server connected to a model with real data can still return that data to the model provider. To start the server read-only in VS Code, add the flag to the args from Microsoft's sample configuration:

{
  "servers": {
    "powerbi-authoring-local": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@microsoft/powerbi-modeling-mcp@latest", "--start", "--readonly"]
    }
  }
}

Connecting to a PBIP folder means the server reads the TMDL definition from disk. Returning query rows requires a model with data loaded, such as one open in Desktop or published to a workspace. If you only want help with structure, for example renaming, adding descriptions or reviewing DAX, connect to the stripped copy's folder or to a model loaded with synthetic data. If you have inherited the model, the agent's first job can be a read-only inventory. The guide to documenting an inherited Power BI model lists what to capture.

PHI and other regulated data: questions for compliance

No file layout makes a tool compliant. Whether you can use an agent with PHI depends on your organization's agreements with the AI vendor and on the deployment you use, such as an enterprise tenant, a specific cloud region, or the retention settings. Your compliance, privacy or security team owns that answer. Ask them specific questions:

  1. Which AI tools and model providers are approved, and under which account type? Is a personal subscription different from the enterprise one?
  2. Do we have a business associate agreement, or an equivalent data processing agreement, with the provider behind the agent? Does it cover this tool and this model?
  3. Does the provider retain prompts or tool results, and for how long? Can it use them for training under our contract?
  4. Where is the data processed, and does that meet our residency rules?
  5. Is metadata alone sensitive here? Table names, column names, M expressions and RLS rules can reveal a lot.
  6. May the agent connect to production models, or only to development models loaded with synthetic or de-identified data?
  7. Who reviews and approves changes the agent makes before they are published?
  8. Do we need an audit trail of agent activity? Given that the local MCP server doesn't write to Fabric audit logs, is its own log enough?

Until you have written answers, the safe default is no real regulated data: work on a stripped copy, use synthetic data for any query testing, and keep the MCP server read-only.

Pre-share checklist

  • The agent works on a copy, not on the folder you publish from.
  • .pbi/cache.abf, both localSettings.json files and every *.pbix are removed from the copy.
  • The scanner shows no DATA lines, and you have checked or cleared every REVIEW file: report filters, slicers, bookmarks, saved DAX queries and Enter data tables.
  • No credentials, keys or .env files are in the folder. Server names are acceptable to your policy, or replaced.
  • Agent deny rules block the data files, in case one comes back.
  • The MCP server is started with --readonly, unless you need writes for this task.
  • Any model the agent can query is loaded with synthetic or approved sample data.
  • Your .gitignore also covers *.pbix if PBIX files end up in the repository.
  • Agent changes come back as a Git diff that you read line by line. Changes to security roles get a separate access test, using this RLS testing walkthrough.
  • Compliance has answered the questions above in writing for any regulated data.

FAQ

If cache.abf is in .gitignore, can an agent still read it?

Yes. .gitignore only controls what Git commits. An agent with access to the folder can open any file in it unless the agent's own permission rules block that file. The simplest protection is to give the agent a copy with no cache file.

Does the read-only flag on the Modeling MCP server keep data private?

No. --readonly stops the server from writing changes to the model. The agent can still run DAX queries and read the results, and those results can be passed to the LLM provider. To keep data private, connect only to models loaded with synthetic or approved data.

Is a PBIP folder without cache.abf free of data?

Not necessarily. Report files can store filter and slicer values. Saved DAX queries and M expressions can contain literal values, and Enter data tables keep their rows in the model definition. Run a scan, check every flagged file, and clear or replace real values before you share the folder.

Interview Prep

Begin Your SQL, Python, and R Journey

Master 230 interview-style coding questions and build the data skills needed for analyst, scientist, and engineering roles.

Related Articles

All Articles