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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nastip
Frequent Visitor

Running Get-PowerBIActivityEvent using registered app as service principal

Hi there,

 

I have a registered app that I want to use in a few scenarios.

 

One being as follow to access the Power BI activity log:

 

Using powershell login/connect as service principal.

>Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credentials -Tenant $TenantId

 

The above part is successful. As a test I can use Get-PowerBIWorkspace and it returns what I expect. This is in terms of the SP has been added as admin to a number of workspaces amd those are returned in the result.

 

However if I run:

>Get-PowerBIActivityEvent

 

I get the error:

Get-PowerBIActivityEvent : Operation returned an invalid status code 'Unauthorized'

 

For the above scenerio, do I require delegated or application permission in the registered app?

 

I am aware that it will be down to not having the correct permissions. I should be able to resolve this with the right request.

 

However, I'm not sure which one would apply with the above. Will delegated work? Or do I need application permissions?

 

Appreciate any help on this.

 

Thanks

 

 

 

 

 

 

 

2 REPLIES 2
jaweher899
Impactful Individual
Impactful Individual

To access the Power BI activity log, you need to have the "Read activity log" application permission. This permission allows you to view activity log events for all workspaces in your Power BI tenant.

To add the "Read activity log" permission to your app, you need to perform the following steps:

  1. Go to the Azure Active Directory (AAD) portal for your tenant.
  2. Find your app registration and click on it.
  3. Click on API permissions.
  4. Click on Add a permission.
  5. Select Microsoft Power BI service from the API list.
  6. Under Delegated Permissions, select "Read activity log" and click on Add permissions.
  7. Click on Grant admin consent to grant consent for the tenant administrator.

Once you have added the "Read activity log" permission to your app, you should be able to run the Get-PowerBIActivityEvent command successfully.

It is important to note that you may need to sign out and sign back in to your Power BI session to refresh the token with the updated permissions.

Hi jaweher899,

Thanks for your response. I'd love to check this out, however, since yesterday, I've encountered an issue where I can't get the app registration page. It's stuck on the 3 dots permanently. Baffling as all other pages work.

nastip_0-1676017527177.png

Hopefully this is a blip.

I've worked in the app registration page before and not come across this particular api permission when adding others under power bi service. Is it new?

 

 

Edit:

Just to give an update, I have not been able to see this api permission under the Power BI Service, either for delegated or application options.

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.