connect-pbid

Connect to Power BI Desktop's local Analysis Services instance via TOM and ADOMD.NET in PowerShell.

887|131|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/data-goblin/power-bi-agentic-development --skill connect-pbid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: connect-pbid
Source: https://github.com/data-goblin/power-bi-agentic-development/tree/main/plugins/pbi-desktop/skills/connect-pbid
Command: npx skills add https://github.com/data-goblin/power-bi-agentic-development --skill connect-pbid

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, gh, curl, dotnet, Microsoft.AnalysisServices.retail.amd64, Microsoft.AnalysisServices.AdomdClient.retail.amd64, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Power BI Desktop exposes no official API for programmatically querying or modifying the semantic model of an open report. This Skill lets an agent connect to Desktop's local Analysis Services instance to enumerate models, run DAX queries, modify metadata, and verify report-canvas changes without manual clicking.

Core Features & Use Cases

  • Model connection and enumeration: Discover msmdsrv.exe ports, connect via the Tabular Object Model (TOM), and list tables, columns, measures, relationships, roles, and calculation groups.
  • DAX querying and validation: Execute DAX queries through ADOMD.NET, validate expressions before saving, capture query traces, and debug with EVALUATEANDLOG.
  • Model modification: Create, update, and delete measures, columns, relationships, roles, field parameters, annotations, and calendar definitions with atomic SaveChanges transactions.
  • DAX library management: Search, download, install, and remove daxlib.org packages (e.g., DaxLib.SVG, IBCS) via the bundled daxlib.sh CLI.
  • Use Case: Ask the agent to add a "Total Revenue" measure to the open PBIP file, then reload and screenshot the report canvas through the Desktop Bridge to verify the change.

Quick Start

Connect to my open Power BI Desktop file and list all tables and measures in the model.

Frequently Asked Questions about connect-pbid

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect to Power BI Desktop programmatically?

Power BI Desktop runs a local Analysis Services instance (msmdsrv.exe) on a dynamic port. Discover the port via netstat or the msmdsrv.port.txt file, then connect with the TOM Server object using "Data Source=localhost:<port>" in PowerShell.

How to run DAX queries against Power BI Desktop from PowerShell?

Load the ADOMD.NET assembly (Microsoft.AnalysisServices.AdomdClient), open an AdomdConnection to localhost:<port>, and execute EVALUATE statements. Access result columns by index with GetName(), since ADOMD returns fully-qualified column names.

Does this work with Direct Lake or Fabric semantic models?

No. The local Analysis Services proxy does not expose Direct Lake databases or remote XMLA endpoint models to external TOM/ADOMD.NET connections. Use the Tabular Editor CLI or a Power BI MCP server for those models instead.

Why does my PowerShell script lose $ variables when run from Bash?

Bash silently consumes PowerShell $ variables like $env:TEMP. Single-quote the -Command argument so Bash passes $ literally, or write a .ps1 file with a single-quoted heredoc and invoke it with -File and -ExecutionPolicy Bypass.

Can I use this on macOS with Power BI Desktop?

Yes, via Parallels. The connect-from-mac.sh wrapper runs PowerShell scripts inside a Windows VM using prlctl, mapping macOS paths to \\Mac\Home UNC shares. Power BI Desktop must be running inside the VM.

What are the limitations of modifying models via TOM in Power BI Desktop?

Changes applied with SaveChanges() cannot be undone with Ctrl+Z in Desktop, and connections must be explicitly disconnected to avoid orphaned processes. Thin reports with live connections have no local model to modify.