<?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: Cannot access Admin APIs with service principal via ADF in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4118252#M54971</link>
    <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/796418"&gt;@cmjcf&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the documentation, when using the PBI admin REST API with service principal authentication,” When running under service prinicipal authentication, an app &lt;STRONG&gt;must not&lt;/STRONG&gt; have any admin-consent required premissions for Power BI set on it in the Azure portal.&amp;nbsp;”&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vyangliumsft_0-1724662423828.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1157063i2B2CF4EB7D074E1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vyangliumsft_0-1724662423828.png" alt="vyangliumsft_0-1724662423828.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-dataset-users-as-admin#permissions" target="_blank"&gt;Admin - Datasets GetDatasetUsersAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;According to my understanding, this means you can try removing all PBI-related API permissions, keeping only the tenant settings enabled, and then check if the API can successfully run using service principal authentication&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="vyangliumsft_1-1724662423836.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1157064i2A7DDC2BE70FE708/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vyangliumsft_1-1724662423836.png" alt="vyangliumsft_1-1724662423836.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2024 08:54:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-26T08:54:21Z</dc:date>
    <item>
      <title>Cannot access Admin APIs with service principal via ADF</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4116126#M54952</link>
      <description>&lt;P&gt;I'm trying to get Azure Data Factory to read data from the Power BI REST API, and I'm almost at the point of giving up.&amp;nbsp; After several false starts, I've got to the following (step numbers are in reference to the &lt;A href="https://learn.microsoft.com/en-us/fabric/admin/metadata-scanning-enable-read-only-apis" target="_self"&gt;documentation&lt;/A&gt;) :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Step 1: I have created a service principal in the Entra tenant&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmjcf_5-1724428904863.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1156350i2F0AABBB1E8051D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmjcf_5-1724428904863.png" alt="cmjcf_5-1724428904863.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;Step 2/3: I have created a security group in the Entra tenant, and added the SP to it&lt;/LI&gt;&lt;LI&gt;Step 4: I have enabled the relevant settings in Fabric tenant admin, and added the SG to the groups that can access admin APIs&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmjcf_0-1724427071578.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1156331iAC0057BC1E8F2678/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmjcf_0-1724427071578.png" alt="cmjcf_0-1724427071578.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;I have removed all permissions from Entra, per the documentation stating that they are not required, and in the case of consent-required permissions, &lt;EM&gt;must not&lt;/EM&gt; be applied&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmjcf_1-1724427239734.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1156333i10FD26C285F6991C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmjcf_1-1724427239734.png" alt="cmjcf_1-1724427239734.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;I've added the API with the SP details as a linked service in ADF&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmjcf_2-1724427372289.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1156334iB7AE4BC83D864D84/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmjcf_2-1724427372289.png" alt="cmjcf_2-1724427372289.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;I've created a dataset for one of the request types&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmjcf_3-1724427476768.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1156335i17AB9AE7BE3B4E69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmjcf_3-1724427476768.png" alt="cmjcf_3-1724427476768.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;I've added the dataset as a source on a Data Flow&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmjcf_4-1724427630622.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1156336iC6DB52F7F40EF5F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmjcf_4-1724427630622.png" alt="cmjcf_4-1724427630622.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;When I try and run the Data Flow in debug mode, I get the following:&lt;/P&gt;&lt;BLOCKQUOTE&gt;Error: at Source 'source1': Failure to read most recent page request: DF-REST_001 - Error response from server: Some({"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}), Status code: 401. Please check your request url and body. (url:&lt;A href="https://api.powerbi.com/v1.0/myorg/admin/groups,request" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/admin/groups,request&lt;/A&gt; body: None, request method: GET)&lt;/BLOCKQUOTE&gt;&lt;P&gt;When I try running the same in Hoppscotch (RIP Postman), I can get a token, but I still get a 401 with the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have verified that the tenant ID and application ID, along with the client secret, are correct.&amp;nbsp; I can access the non-admin APIs just fine.&amp;nbsp; I tried using the object ID instead of the application ID but that results in the following error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;Failed to get access token by using service principal. Error: unauthorized_client, Error Message: AADSTS700016: Application with identifier 'e2e9978f-6d27-40da-974b-3bff70258121' was not found in the directory [...]&lt;/BLOCKQUOTE&gt;&lt;P&gt;I've looked at &lt;A href="https://forwardforever.com/how-to-use-service-principal-in-power-bi-admin-rest-api-in-power-automate/" target="_self"&gt;several&lt;/A&gt; &lt;A href="https://stackoverflow.com/questions/53819540/status-unauthorized-401-error-while-getting-the-reports-from-the-workspace" target="_self"&gt;resources&lt;/A&gt; &lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/troubleshoot-rest-api" target="_self"&gt;already&lt;/A&gt; and just can't think of what I might be missing here.&amp;nbsp; I found exactly &lt;A href="https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Returns-quot-PowerBINotAuthorizedException-quot/m-p/2876779" target="_self"&gt;one result&lt;/A&gt; on Google for the combination of the ADF and API errors, and it doesn't say anything useful - it just repeats what's in Step 4 of the documentation, which I have already done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No generic responses please, I've read them already and they weren't helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 16:17:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4116126#M54952</guid>
      <dc:creator>cmjcf</dc:creator>
      <dc:date>2024-08-23T16:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot access Admin APIs with service principal via ADF</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4118252#M54971</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/796418"&gt;@cmjcf&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the documentation, when using the PBI admin REST API with service principal authentication,” When running under service prinicipal authentication, an app &lt;STRONG&gt;must not&lt;/STRONG&gt; have any admin-consent required premissions for Power BI set on it in the Azure portal.&amp;nbsp;”&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vyangliumsft_0-1724662423828.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1157063i2B2CF4EB7D074E1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vyangliumsft_0-1724662423828.png" alt="vyangliumsft_0-1724662423828.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-dataset-users-as-admin#permissions" target="_blank"&gt;Admin - Datasets GetDatasetUsersAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;According to my understanding, this means you can try removing all PBI-related API permissions, keeping only the tenant settings enabled, and then check if the API can successfully run using service principal authentication&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="vyangliumsft_1-1724662423836.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1157064i2A7DDC2BE70FE708/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vyangliumsft_1-1724662423836.png" alt="vyangliumsft_1-1724662423836.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 08:54:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4118252#M54971</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-26T08:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot access Admin APIs with service principal via ADF</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4119516#M54989</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think we're getting confused somewhere.&amp;nbsp; In case you're not familiar with the Entra API Permissions blade, the text in that second heading is "Other permissions granted for &amp;lt;tenant name&amp;gt;".&amp;nbsp; The service principal doesn't have any of those permissions.&amp;nbsp; Those are listed as available, because it previously had them, but I removed them, because the documentation stated that they weren't needed and they weren't working anyway.&amp;nbsp; It only has the single permission listed under "Configured permissions".&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 23:59:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4119516#M54989</guid>
      <dc:creator>cmjcf</dc:creator>
      <dc:date>2024-08-26T23:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot access Admin APIs with service principal via ADF</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4123367#M55014</link>
      <description>&lt;P&gt;Gave up, went through the instructions again with a new service principal, and now it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;¯\_(ツ)_/¯&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 18:54:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4123367#M55014</guid>
      <dc:creator>cmjcf</dc:creator>
      <dc:date>2024-08-28T18:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot access Admin APIs with service principal via ADF</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4605488#M59798</link>
      <description>&lt;P&gt;Did you do anything differently the second time around? Do you have a link to the steps you followed?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 16:16:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4605488#M59798</guid>
      <dc:creator>PriyankaSS</dc:creator>
      <dc:date>2025-03-11T16:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot access Admin APIs with service principal via ADF</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4765333#M62237</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I had this problem; I had added all these permissions. It's not necessary.&lt;BR /&gt;What I did:&lt;BR /&gt;1- Don't add any permissions to the SPN.&lt;BR /&gt;2- Add the security group to which the SPN belongs (or simply the SPN) as the Workspace Admin.&lt;/P&gt;&lt;P&gt;And it worked.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BI225_0-1752671171550.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1283638iBEABDEB6D7ED5659/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BI225_0-1752671171550.png" alt="BI225_0-1752671171550.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 13:06:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-access-Admin-APIs-with-service-principal-via-ADF/m-p/4765333#M62237</guid>
      <dc:creator>BI225</dc:creator>
      <dc:date>2025-07-16T13:06:27Z</dc:date>
    </item>
  </channel>
</rss>

