<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using a Service Principal for the Activity Events API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/1941424#M30371</link>
    <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/267908"&gt;@andymc&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;AFAIK, these logs are pull from audit logs, have you enable this feature before the test?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/service-admin-auditing" target="_blank"&gt;Track user activities in Power BI - Power BI | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In addition, this is one of the admin rest API. it was different from common rest APIs and it requires additional admin permission to use. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;For this scenario, I'd like to suggest you check the test account settings to confirm it has enough permissions.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) to call this API or authenticate via service principal.&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jul 2021 01:44:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-07-07T01:44:28Z</dc:date>
    <item>
      <title>Using a Service Principal for the Activity Events API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/1936680#M30313</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been setting up a proof of concept on accessing Activity Events API using a Service Principal account.&amp;nbsp; I have worked out most of the issues but am currently getting the error code 401 and haven't been able to pinpoint the registered application setup as well as any permissions that are needed to be added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have followed multiple articles outlining the setup and have hopefully summarized well enough below.&amp;nbsp; But any feedback would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have started out with the Daemon Application code from the .Net Core Quick Start Code in the Azure Application Setup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to get authenticated correctly, using the Client Secret.&amp;nbsp; I have also confirmed that I can successfully issue my GET against the User.Read API in Microsoft.Graph.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I switched the resource and call over to Power Bi I am now getting a 401 error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the call my resource is:&amp;nbsp;&lt;EM&gt;&lt;A href="https://analysis.windows.net/powerbi/api/.default" target="_blank" rel="noopener"&gt;https://analysis.windows.net/powerbi/api/.default&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The call I am trying to issue is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;A href="https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime={startTime}&amp;amp;endDateTime={endTime}" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime={startTime}&amp;amp;endDateTime={endTime}&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The application permissions setup are&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="App Configured Permissions.jpg" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/546096i61548F71DD971C0C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="App Configured Permissions.jpg" alt="App Configured Permissions.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have setup a Security Group (PowerBiTestSecrurityGroup) in Azure with the Application Service Principal setup as a member.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly I have gone into Power Bi and enabled the Admin API Settings for that security group.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Powr Bi Security Settings.JPG" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/546095i5DC0A78E06EE5191/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Powr Bi Security Settings.JPG" alt="Powr Bi Security Settings.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point I was really hoping to identify any final adjustments that are needed to execute this call using a Daemon Application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jul 2021 21:19:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/1936680#M30313</guid>
      <dc:creator>andymc</dc:creator>
      <dc:date>2021-07-04T21:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Service Principal for the Activity Events API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/1941424#M30371</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/267908"&gt;@andymc&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;AFAIK, these logs are pull from audit logs, have you enable this feature before the test?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/service-admin-auditing" target="_blank"&gt;Track user activities in Power BI - Power BI | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In addition, this is one of the admin rest API. it was different from common rest APIs and it requires additional admin permission to use. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;For this scenario, I'd like to suggest you check the test account settings to confirm it has enough permissions.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) to call this API or authenticate via service principal.&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 01:44:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/1941424#M30371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-07T01:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Service Principal for the Activity Events API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/2013737#M31084</link>
      <description>&lt;P&gt;After a lot of trial and error I have finally solved the issue.&amp;nbsp; I am not entirely certain why this is the case but when I remove all references to Power BI API calls from Azure API Permissions setup in the Azure App Registration the call works.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="API Permissions.jpg" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/572152i90D81955AA4ED0B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="API Permissions.jpg" alt="API Permissions.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 18:52:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/2013737#M31084</guid>
      <dc:creator>andymc</dc:creator>
      <dc:date>2021-08-12T18:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Service Principal for the Activity Events API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/2508104#M36033</link>
      <description>&lt;P&gt;This does actually work. I also removed all of the permissions of a Service Principal I wasn't using and tried to call the Power BI Admin Activity Events API, and it got back the report usage data.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 15:23:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/2508104#M36033</guid>
      <dc:creator>mbutler71</dc:creator>
      <dc:date>2022-05-11T15:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Service Principal for the Activity Events API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/3138450#M41799</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Remove Tenant.ReadAll and Tenant.ReadWriteAll. It writted in documentation.&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/get-activity-events#permissions" target="_blank" rel="nofollow noopener noreferrer"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/get-activity-events#permissions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And there&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/75742033/get-401-error-when-try-to-get-power-bi-activity-events-audit-logs/75742846#75742846" target="_blank"&gt;https://stackoverflow.com/questions/75742033/get-401-error-when-try-to-get-power-bi-activity-events-audit-logs/75742846#75742846&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 10:15:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-a-Service-Principal-for-the-Activity-Events-API/m-p/3138450#M41799</guid>
      <dc:creator>VSmart</dc:creator>
      <dc:date>2023-03-17T10:15:46Z</dc:date>
    </item>
  </channel>
</rss>

