Get-PBIGroupUsers returns a 401 error
ed-on-data opened this issue · 1 comments
ed-on-data commented
I'm getting the following error when I run Get-PBIGroupUsers
Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At C:\Program Files\WindowsPowerShell\Modules\PowerBIPS\1.3.4.0\PowerBIPS.psm1:421 char:12
- ... $users = Invoke-RestMethod -Uri (Get-PowerBIRequestUrl -scope "use ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Other functions work; only when I remove the comment # below do I get the error
$clientid = MyClientID
$authToken = Get-PBIAuthToken -ClientId $clientid -Credential (new-object System.Management.Automation.PSCredential("<username>",(ConvertTo-SecureString -String "<password>" -AsPlainText -Force)))
$pbiGroups= Get-PBIGroup
foreach ($pbiGroup in $pbiGroups) {
echo $pbiGroup.name
Set-PBIGroup -name $pbiGroup.name
#Get-PBIGroupUsers -authToken $authToken
}
ed-on-data commented
Turns out my Power BI Pro trial expired this morning so I couldn't access groups. Got myself a Power BI Pro license and the issue was resolved