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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
KrishnaKolwuri
Advocate I
Advocate I

Get-PowerBIActivityEvent - throws Unauthorized error though I am power bi service admin.

Get-PowerBIActivityEvent -StartDateTime $StartDate -EndDateTime $EndDate | ConvertFrom-Json |Out-File -FilePath C:\AuditLogs\RSActivityLog.json
Get-PowerBIActivityEvent : Operation returned an invalid status code 'Unauthorized'
At line:1 char:1
+ Get-PowerBIActivityEvent -StartDateTime $StartDate -EndDateTime $EndD ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...BIActivityEvent:GetPowerBIActivityEvent) [Get-PowerBIActivityEvent], HttpOperationException
+ FullyQualifiedErrorId : Operation returned an invalid status code 'Unauthorized',Microsoft.PowerBI.Commands.Admin.GetPowerBIActivityEvent

2 ACCEPTED SOLUTIONS
GilbertQ
Super User
Super User

Hi there

Can you confirm that you have got Power BI Admin permissions?

To view this you could go into the Power BI Service , then Admin Portal and see if you can see the tenant settings.

If you do not see the tenant settings, you do not have the required access.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

v-lionel-msft
Community Support
Community Support

Hi @KrishnaKolwuri ,

What Operation did you do before the warning happened? And what's your Power BI License? Maybe related to these factors.

In fact, there are multiple administrator roles in Power BI, first, you can ask "Office 365 Global Administrator" to check if you have the corresponding identity and permissions in office 365 admin portal.

What is Power BI administration? 

 

If these's OK, please refer to these:

https://stackoverflow.com/questions/49037233/operation-returned-an-invalid-status-code-unauthorized 

https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.admin/Get-PowerBIActivityEve... 

 

Best regards,
Lionel Chen

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

4 REPLIES 4
GuillaumeMH
New Member

hi,

 

The account need Power BI Administrator AND have the licence on Power BI Free.

v-lionel-msft
Community Support
Community Support

Hi @KrishnaKolwuri ,

What Operation did you do before the warning happened? And what's your Power BI License? Maybe related to these factors.

In fact, there are multiple administrator roles in Power BI, first, you can ask "Office 365 Global Administrator" to check if you have the corresponding identity and permissions in office 365 admin portal.

What is Power BI administration? 

 

If these's OK, please refer to these:

https://stackoverflow.com/questions/49037233/operation-returned-an-invalid-status-code-unauthorized 

https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.admin/Get-PowerBIActivityEve... 

 

Best regards,
Lionel Chen

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

 

Hello, 

 

I have the some problem. I can login with Tenant credential, but I don't get error:

Operation returned an invalid status code 'Unauthorized':

 

 

 

 

using (var client = new PowerBIClient(new Uri("https://api.powerbi.com/"), m_tokenCredentials))
{
var reports = await client.Reports.GetReportsInGroupAsync(WorkspaceId).ConfigureAwait(false);

 

 

 

 

Workspace Id exist and if I login with username and password credentials It works.

 

In power Bi:

 

powerb-tenant-2.jpg

I have try se applay permision to the entrier organziation. But in all case I get the some error

 

azure application permission:

powerb-tenant.jpg

powerb-tenant.jpg

 

powerb-tenant.jpg

 

What I do wrong?

GilbertQ
Super User
Super User

Hi there

Can you confirm that you have got Power BI Admin permissions?

To view this you could go into the Power BI Service , then Admin Portal and see if you can see the tenant settings.

If you do not see the tenant settings, you do not have the required access.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors