Power BI & PowerShell

See also my general PowerShell reference page

Microsoft Power BI PowerShell samples

This repo contains samples for calling the Power BI REST APIs using PowerShell. Each PowerShell script is self-documenting

⚡ manageRefresh.ps1 – trigger scheduled refresh and check refresh history
⚡ rebindReport.ps1 – clone a report in the Power BI service and rebind it to a different dataset
⚡ copyWorkspace.ps1 – duplicate a workspace in the Power BI service
⚡ bindtogateway.ps1 – Binds a dataset to a new gateway.
⚡ takeover-dataset.ps1 – Takes ownership of a dataset to your account.
⚡ Zero-Downtime-Capacity-Scale.ps1 – scale Power BI Embedded capacity resource, up or down, with no downtime (i.e. embedded content is available during the scaling process).
Microsoft Power BI Cmdlets for Windows PowerShell and PowerShell CoreMicrosoft PowerShell documentation and list of cmdlets (PDF download available, too)
Celebrating our first community contribution to the Power BI management cmdletsby Kay Unkroth at the Microsoft Power BI blog {bunch of other links on that page}
Power BI Management cmdlets in Azure Cloud Shellalso by Kay Unkroth
AUTOMATING POWER BI DEPLOYMENTS: A SERIESby Martin Schoombee

⚡ PowerShell basics
⚡ Connecting to the service
⚡ Creating a workspace
⚡ Deploying reports
⚡ Update report parameters
⚡ Change data source credentials
⚡ Update refresh schedule
⚡ Trigger a refresh
⚡ Assign workspace permissions
A Series by John Miner at Managing Power BI Workspaces with PowerShell

Manage Power BI Reports with PowerShell

Manage Power BI Dataset with PowerShell
Build Your Own Power BI Audit Log; Usage Metrics Across the Entire Tenantby Reza Rad at RADACAD
Writing PowerShell Scripts for Power BIby Power BI Dev Camp (run by Ted Pattison of the Power BI Customer Advisory Team (CAT) at Microsoft

What Campers Will Learn:
⚡ Install the Power BI cmdlet library for PowerShell
⚡ Authenticate to the Power BI Service as a User and as a Service Principal
⚡ Write scripts to create new workspaces and to manage workspace users
⚡ Write scripts to upload PBIX files, patch datasource credentials and refresh datasets.
⚡ Call Power BI Service API operations directly using Invoke-PowerBiRestMethod
⚡ Export event activity from the Power BI activity log to monitor usage

Teams video (1:06:50), PowerPoint, and 23pp. PDF Tutorial! Get the .zipped code file HERE.
COMMON POWER BI ADMIN SCRIPTS PART IIby Brett Powell at Insight Inquest. Of course, there’s a “Part I”, and perhaps subsequent parts have been posted by now.
Get the Governance Data You Need Out of Your Power BI Gateways with PowerShellby Aaron Nelson at SQLVariant. At the time of this writing, requires use of PowerShell Core
Quick Blog: Run PowerShell Core from the PowerShell Integrated ConsoleAlso by Aaron Nelson
Power BI REST API“Provides service endpoints for embedding, administration, and user resources”.

There are sixteen REST Operation Groups!