Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
aaldo_666
Helper I
Helper I

Run Get-PowerBIActivityEvent with Service Principal

Hi, 

I registered app in AAD and enabled Service Principal option in Power BI Admin portal.

So far I can run this cmd let:

 

$AppId = "AppId"
$TenantId = "TenantId"
$ClientSecret = "ClientSecret"

#Create secure string & credential for application id and client secret
$PbiSecurePassword = ConvertTo-SecureString $ClientSecret -Force -AsPlainText
$PbiCredential = New-Object Management.Automation.PSCredential($AppId, $PbiSecurePassword)

#Connect to the Power BI service
Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $TenantId -Credential $PbiCredential

Get-PowerBIWorkspace -first 5
Get-PowerBIReport -WorkspaceId 666
Get-PowerBIDataset -WorkspaceId 666

 

AAD app permissions:

aaldo_666_0-1664207011782.png

 

But Im not able to run any of MicrosoftPowerBIMgmt.Admin cmd lets. Im expecially interested in Get-PowerBIActivityEvent.

I can run Get-PowerBIActivityEvent with my credentials, but for automation I wanted to use service principal.

Any idea what permissions is service principal missing?

 

My goal it to run automatically from win scheduler:

Get-PowerBIActivityEvent -StartDateTime $start_day -EndDateTime $end_day

Thanks.

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @aaldo_666 ,

 

vchenwuzmsft_0-1664261668413.png

Maybe you can refer this guide:

Admin - Get Activity Events - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @aaldo_666 ,

 

vchenwuzmsft_0-1664261668413.png

Maybe you can refer this guide:

Admin - Get Activity Events - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.