Modules/Get-WorkspacesAsAdmin.psm1
<#
.Synopsis Returns a list of workspaces as administrator. Requires Office 365 or Power BI admin privileges. .Parameter AuthorizationHeader The OAuth token wrapped in a header. Can be obtained with Get-AuthorizationHeader. .Example $workspaces = Get-Groups -AuthorizationHeader $AuthorizationHeader #> function Get-WorkspacesAsAdmin { Param ( [Parameter(Mandatory=$true)] [System.Collections.IDictionary]$AuthorizationHeader ) $uri = "https://api.powerbi.com/v1.0/myorg/admin/groups" $groups = Invoke-RestMethod -Uri $uri -Headers $AuthorizationHeader -Method GET return $groups.value } |