Forum Discussion

KrishnaKolwuri's avatar
KrishnaKolwuri
Advocate I
6 years ago
Solved

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

4 Replies

  • 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.
  • v-lionel-msft's avatar
    v-lionel-msft
    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-PowerBIActivityEvent?view=powerbi-ps 

     

    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.

     

    • dolenc's avatar
      dolenc
      Frequent Visitor

      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:

       

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

       

      azure application permission:

       

       

      What I do wrong?

  • hi,

     

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