Microsoft Power BI Cmdlets for Windows PowerShell and PowerShell Core

Welcome to the PowerShell reference for Microsoft Power BI. Here you will find resources for PowerShell modules targeting Power BI.

PowerShell Modules

Below is a table of the Power BI PowerShell modules covered in this reference.

Description Module Name PowerShell Gallery link
Rollup module for Power BI Cmdlets MicrosoftPowerBIMgmt MicrosoftPowerBIMgmt
Data module for Power BI Cmdlets MicrosoftPowerBIMgmt.Data MicrosoftPowerBIMgmt.Data
Profile module for Power BI Cmdlets MicrosoftPowerBIMgmt.Profile MicrosoftPowerBIMgmt.Profile
Reports module for Power BI MicrosoftPowerBIMgmt.Reports MicrosoftPowerBIMgmt.Reports
Workspaces module for Power BI MicrosoftPowerBIMgmt.Workspaces MicrosoftPowerBIMgmt.Workspaces

Supported Environments and PowerShell Versions

  • Windows PowerShell v3.0 and up with .NET 4.7.1 or above.
  • PowerShell Core (v6) and up on any OS platform supported by PowerShell Core.

Installation

The cmdlets are available on PowerShell Gallery and can be installed in an elevated PowerShell session:

Install-Module -Name MicrosoftPowerBIMgmt

Optionally you could install individual modules (based on your needs) instead of the rollup module, for example if you only wanted the Workspaces module:

Install-Module -Name MicrosoftPowerBIMgmt.Workspaces

If you have an earlier version, you can update to the latest version by running:

Update-Module -Name MicrosoftPowerBIMgmt

Uninstall

If you want to uninstall all the Power BI PowerShell cmdlets, run the following in an elevated PowerShell session:

Get-Module MicrosoftPowerBIMgmt* -ListAvailable | Uninstall-Module -Force

Usage

Two scopes are supported by cmdlets that interact with Power BI entities:

  • Individual is used to access entities that belong to the current user.
  • Organization is used to access entities across the entire company. Only Power BI tenant admins are allowed to use.

Log in to Power BI

Connect-PowerBIServiceAccount   # or Login-PowerBIServiceAccount

Get workspaces

Get all workspaces for the user:

Get-PowerBIWorkspace

Update a workspace

Update the name or description of a user's workspace:

Set-PowerBIWorkspace -Scope Organization -Id "3244f1c1-01cf-457f-9383-6035e4950fdc" -Name "Test Name" -Description "Test Description"

Add a new user to a workspace

Add a user to a given workspace:

Add-PowerBIWorkspaceUser -Scope Organization -Id 3244f1c1-01cf-457f-9383-6035e4950fdc -UserEmailAddress john@contoso.com -AccessRight Admin

Remove a user from a given workspace

Remove user's permissions from a given workspace:

Remove-PowerBIWorkspaceUser -Scope Organization -Id 3244f1c1-01cf-457f-9383-6035e4950fdc -UserEmailAddress john@contoso.com

Restore a workspace

Restore a deleted workspace:

Restore-PowerBIWorkspace -Id "3244f1c1-01cf-457f-9383-6035e4950fdc" -RestoredName "TestWorkspace" -AdminEmailAddress "john@contoso.com"

Get reports

Get all reports for the user:

Get-PowerBIReport

Issues and feedback

If you find any bugs or would like to see certain functionality implemented for the PowerShell Cmdlets for Power BI, please file an issue.

If your issue is broader than just the PowerShell cmdlets, please submit your feedback to the Power BI Community or the official Power BI Support site.