PBI_Audit.ps1 performs a one-time tenant-wide audit of your Power BI environment using the Admin Scanner API. It discovers all workspaces in the tenant, scans them in batches of 100 (with lineage and datasource details enabled), and exports the results as flat CSV files and a raw JSON dump.
The script requires a Power BI admin account (Fabric Admin or Power BI Service Admin) and uses the MicrosoftPowerBIMgmt PowerShell module for authentication and REST calls.
- PowerShell 5.1+ (Windows PowerShell or PowerShell 7)
- A Power BI admin account (Fabric Admin or Power BI Service Admin role)
- Internet access to reach the Power BI REST API
- Open a PowerShell terminal.
- Run the script:
.\PBI_Audit.ps1
- If the
MicrosoftPowerBIMgmtmodule is not installed, the script will install it automatically for the current user. - A browser-based sign-in prompt will appear — authenticate with your admin account.
- The script will scan workspaces, poll for completion, and export results to a timestamped subfolder under
output\(e.g.,output\2026-04-11_0810\). Each run creates a new subfolder so previous results are preserved.
Note: Scanning may take several minutes depending on the number of workspaces. Each batch has a 10-minute timeout.
All files are saved to a timestamped subfolder under output\ (e.g., output\2026-04-11_0810\):
| File | Description |
|---|---|
ScanRaw.json |
Complete raw JSON response from the Scanner API |
Workspaces_All.csv |
All workspaces with ID, name, type, state, capacity info |
Workspaces_ProShared.csv |
Workspaces not on dedicated/Premium capacity (Pro or shared) |
Reports_All.csv |
All reports with workspace mapping, dataset ID, created/modified metadata |
Datasets_All.csv |
All datasets with workspace mapping, configured by, and gateway ID |
Dataset_Datasources.csv |
Datasource connection details per dataset (type, connection string, gateway) |
Dataset_GatewayBindings.csv |
Datasets that are bound to an on-premises data gateway |