<?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: Error accessing Power BI REST API: Admin - Get Activity Events using Service Principal auth in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1983121#M30761</link>
    <description>&lt;P&gt;If chrisarys response doesnt help, try changing resource_url to &lt;A href="https://analysis.windows.net/powerbi/api/.default" target="_blank"&gt;https://analysis.windows.net/powerbi/api/.default&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to include the .default bit at the end of the URL to ensure the token generated gave access to all of the Power BI api.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 21:25:54 GMT</pubDate>
    <dc:creator>DavidCousinsT</dc:creator>
    <dc:date>2021-07-27T21:25:54Z</dc:date>
    <item>
      <title>Error accessing Power BI REST API: Admin - Get Activity Events using Service Principal auth</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1976347#M30678</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to access the Get Activity Events using Service Principal auth with Python.&lt;/P&gt;&lt;P&gt;I did succesfully manage to obtain the token, however using below's code I get the following error upon retrieving activity events from the API..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{'error': {'code': 'PowerBINotAuthorizedException', 'pbi.error': {'code': 'PowerBINotAuthorizedException', 'parameters': {}, 'details': [], 'exceptionCulprit': 1}}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import adal
import requests
import json
import datetime

tenant_id = ""
authority_url = 'https://login.microsoftonline.com/'+tenant_id+'/'
resource_url = 'https://analysis.windows.net/powerbi/api'
client_secret = ""
client_id = ""
context = adal.AuthenticationContext(authority=authority_url,
                                     validate_authority=True,
                                     api_version=None)
token = context.acquire_token_with_client_credentials(resource_url, client_id, client_secret)
access_token = token.get('accessToken')

print(requests.get(f"https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='2021-07-22T00:00:00Z'&amp;amp;endDateTime='2021-07-22T23:59:59Z'", headers = {'Authorization': f'Bearer {access_token}'}).json())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- I enabled Service Principal Read Only API in the admin portal in Power BI.&lt;/P&gt;&lt;P&gt;- I added the App Registration to the security group that is assigned in the setting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 17:04:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1976347#M30678</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-23T17:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error accessing Power BI REST API: Admin - Get Activity Events using Service Principal auth</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1978512#M30703</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Have you worked with the account that has enough permission to operation and traces these activity logs? Did these contents managed in premiums capacity?&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Please share more detailed information to help us clarify this scenario:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 06:49:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1978512#M30703</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-26T06:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error accessing Power BI REST API: Admin - Get Activity Events using Service Principal auth</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1982228#M30749</link>
      <description>&lt;P&gt;we had the same issue and after investigations with MS support we found out that the Admin Consent should be removed from the app permissions.&amp;nbsp; Once removed the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PowerBINotAuthorizedException&lt;/PRE&gt;&lt;P&gt;error was gone !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps ?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 13:54:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1982228#M30749</guid>
      <dc:creator>chrisarys</dc:creator>
      <dc:date>2021-07-27T13:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error accessing Power BI REST API: Admin - Get Activity Events using Service Principal auth</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1983121#M30761</link>
      <description>&lt;P&gt;If chrisarys response doesnt help, try changing resource_url to &lt;A href="https://analysis.windows.net/powerbi/api/.default" target="_blank"&gt;https://analysis.windows.net/powerbi/api/.default&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to include the .default bit at the end of the URL to ensure the token generated gave access to all of the Power BI api.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 21:25:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/1983121#M30761</guid>
      <dc:creator>DavidCousinsT</dc:creator>
      <dc:date>2021-07-27T21:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error accessing Power BI REST API: Admin - Get Activity Events using Service Principal auth</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/4209284#M57035</link>
      <description>&lt;P&gt;I'm facing the same issue, can you give me more information on how to do this please?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 15:47:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-accessing-Power-BI-REST-API-Admin-Get-Activity-Events/m-p/4209284#M57035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-01T15:47:47Z</dc:date>
    </item>
  </channel>
</rss>

