PowerShell Module for retrieving Power BI Metadata via the REST API
Switch branches/tags
Nothing to show
Clone or download
Latest commit bd97eab Jul 23, 2018



This is a collection of Power BI API functions to access Power BI Metadata.

PowerShell Gallery Page: https://www.powershellgallery.com/packages/PowerBI-Metadata


Power BI or Azure App

To facilitate authentication to Power BI we must use an App created in Power BI or Azure.


App Name - Name your app appropriately

Redirect URL - This can be entered as any URL with the Server-side Web app as it is not required

Home Page URL - This can be entered as any URL with the Server-side Web app as it is not required

App Type

  • Server-side Web App / API - Required to utilise the unattended authentication function. You will be provided with a ClientID and a Client_Secret
  • Native App - Used for prompted authentication. Only provides a ClientID

Choose APIs to access - All APIs should be selected unless you intend to use this app in a restricted environment or use multiple apps for consumption & distribution of data

NOTE: First use of an "App" needs to be granted permission from Azure Portal (-> go to Azure Active Directory -> App Registrations -> find your app -> Required Permissions -> Grant Permissions.)


Install-Module -Name PowerBI-Metadata

Sample Commands

Authenticate to Power BI $auth = Get-PBIAuthTokenPrompt -clientId "f40daa92-XXXX-XXXX-XXXX-7e027fe03e2e"

Return all Workspaces Get-PBMWorkspace -authToken $auth

Return all datasets for a specific Workspace Get-PBMDataset -authToken $auth -workspaceName 'Workspace Name'

Return the last 10 Refresh history for all datasets in Workspace Get-PBMDataset -authToken $auth -workspaceName 'GBI Dev' | foreach{Get-PBMDatasetRefreshHistory -authToken $auth -workspaceID $_.WorkspaceID -DatasetID $_.id}