Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

PowerShell authentication with service Principal failing



$client_id = <ClientID>
$tenant_id =  <SecretID>
$secret =  <Secret>

$SecurePassword = ConvertTo-SecureString $secret -Force -AsPlainText
$servicePrincipal = New-Object -TypeName PSCredential -ArgumentList $client_id, $SecurePassword

Connect-PowerBIServiceAccount -ServicePrincipal -Credential $servicePrincipal -Environment Public -Tenant $tenant_id




Environment : Public
TenantId :
ClientId : <ClientID>
Password : ********


As you can see tenantid is returned as empty.  When I try to call APIs I get this error message:



Invoke-PowerBIRestMethod : One or more errors occurred.
At line:1 char:1
+ Invoke-PowerBIRestMethod -Url ' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
    + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod



 What am I doing wrong? 

Frequent Visitor


Invoke-PowerBIRestMethod -Url '<GROUPID>/users' -Method Get

Please note that my app has the following permissions:



Community Support
Community Support

Hi @BoNDoK00 

What kind of API are you using and can you provide the API you are using for testing ?


Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Invoke-PowerBIRestMethod -Url '<GROUPID>/users' -Method Get

Please note that my app has the following permissions:




Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors