Get-Datasets.ps1
function Get-Datasets { Param ( [Parameter(Mandatory=$true)] [System.Collections.IDictionary]$AuthorizationHeader, [Parameter(Mandatory=$true)] [String]$GroupID ) try { $uri = "https://api.powerbi.com/v1.0/myorg/groups/$GroupID/datasets" $datasets = Invoke-RestMethod -Uri $uri -Headers $AuthorizationHeader -Method GET $datasets.value | Add-Member -NotePropertyName "group" -NotePropertyValue $GroupID return $datasets.value } catch { Write-Warning "Error while enumerating datasets in '$GroupID': $($_.Exception.Message)" return $null } } |