Skip to content

vdvoorder/pro-bpa-scanner

Repository files navigation

Pro BPA Scanner

License: MIT PowerShell 5.1+ Python 3.8+

BPA scanning for Fabric semantic models in Pro workspaces — no Premium capacity or XMLA endpoints required.

Combines Fabric CLI (REST API extraction) with Tabular Editor 2 (BPA rule engine) to analyze semantic models headlessly, enabling CI/CD automation for any Fabric workspace.

Why This Tool?

Approach XMLA Required Premium Required CI/CD Ready
Tabular Editor direct Yes Yes Partial
Fabric Notebooks (semantic-link-labs) No Yes Partial
This tool No No Yes

Output

Dashboard Overview

Quick Start

# Scan all models in a workspace (.Workspace suffix optional)
./scan-workspaces.ps1 -Workspaces "YourWorkspace"

# Scan multiple workspaces
./scan-workspaces.ps1 -Workspaces "Production", "Development"

# Scan specific model
./scan-workspaces.ps1 -Workspaces "YourWorkspace" -Model "YourModel.SemanticModel"

# Filter by pattern
./scan-workspaces.ps1 -Workspaces "YourWorkspace" -Filter "Sales.*"

# With custom rules
./scan-workspaces.ps1 -Workspaces "YourWorkspace" -CustomRulesFile "./my-rules.json"

Scan Start

Scan Complete

How It Works

Architecture

See docs/architecture.md for detailed component documentation.

Parameters

Parameter Required Description
-Workspaces Yes One or more workspace names (.Workspace suffix optional)
-Model No Specific model to scan (.SemanticModel suffix required)
-Filter No Regex pattern to filter models
-RulesFile No Path to BPA rules JSON (default: ./BPARules-PowerBI.json)
-CustomRulesFile No Path to custom rules JSON (merged with default rules)
-OutputDir No Output directory for reports (default: ./output)

View Results

# Python dashboard (recommended)
python bpa-dashboard.py

# Or process JSON directly
cat output/bpa-analysis-*.json | jq '.violations'

Prerequisites

See PREREQUISITES.md for installation requirements:

Output Format

{
  "metadata": {
    "timestamp": "2025-12-15T12:00:00Z",
    "model": "Sales Model",
    "workspace": "Production"
  },
  "modelStructure": {
    "tables": 10,
    "measures": 25,
    "relationships": 8
  },
  "violations": [
    {
      "rule": "DAX_DIVISION_COLUMNS",
      "object": "Sales.Revenue Ratio",
      "severity": 3,
      "message": "Avoid division (use DIVIDE function instead)"
    }
  ]
}

Severity Levels

Level Name Action
3 Error Fix before deployment
2 Warning Consider fixing
1 Info Optional improvement

CI/CD Integration

See .github/workflows/bpa-scan.yml for a GitHub Actions template.

Required secrets:

  • FABRIC_CLIENT_ID - Service principal app ID
  • FABRIC_CLIENT_SECRET - Service principal secret
  • FABRIC_TENANT_ID - Azure AD tenant ID

Project Structure

pro-bpa-scanner/
├── scan-workspaces.ps1              # Main scanner entry point
├── lib/                      # PowerShell modules
│   ├── Discover-Models.ps1   # Workspace model discovery
│   ├── Extract-Model.ps1     # TMDL extraction via Fabric CLI
│   ├── Analyze-Model.ps1     # BPA analysis via Tabular Editor 2
│   └── Format-Report.ps1     # JSON report generation
├── bpa_dashboard/            # Python dashboard package
├── bpa-dashboard.py          # Dashboard entry point
├── BPARules-PowerBI.json     # BPA rule definitions
├── output/                   # JSON analysis reports (generated)
├── temp/                     # TMDL extraction (temporary, auto-cleaned)
└── PREREQUISITES.md          # Installation guide

Known Limitations

Calculated Table Column Detection

When comparing scanner results with Tabular Editor 3 GUI connected directly to a model, the scanner may report fewer violations. This is due to a limitation in Tabular Editor 2 CLI mode when analyzing TMDL exports.

Affected rules (violations on Calculated Table Columns may be missed):

  • APPLY_FORMAT_STRING_COLUMNS - Provide format string for visible numeric columns
  • META_AVOID_FLOAT - Do not use floating point data types
  • META_SUMMARIZE_NONE - Don't summarize numeric columns

Root cause: Tabular Editor 2 CLI analyzing TMDL exports does not evaluate certain metadata rules against Calculated Table Columns the same way TE3 GUI does when connected to a live model.

Impact: Scanner results are directionally accurate but may undercount by ~5-15% for models with many Calculated Table Columns. Critical violations (DAX issues, unused columns, relationship naming) are fully detected.

Acknowledgments

License

MIT

About

BPA scanning for Fabric semantic models without Premium capacity or XMLA endpoints. Vibe-coded with Claude Code.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors