<?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: Admin API's and Service Principal Authentication = 401 Unauthorized in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2958369#M40218</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315791" data-lia-user-login="powerbi_jenhen" class="lia-mention lia-mention-user"&gt;powerbi_jenhen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;According to the error code, it seems that you didn't get the proper permission to access Admin REST API. Please check if you enable the option&amp;nbsp;&lt;STRONG&gt;Allow service principals to use read-only Power BI admin APIs &lt;/STRONG&gt;under&amp;nbsp;&lt;STRONG&gt;Admin API settings&amp;nbsp;&lt;/STRONG&gt;in Admin portal.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/lb-lu/power-bi/enterprise/read-only-apis-service-principal-authentication" target="_self"&gt;Enable service principal authentication for read-only admin APIs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Fri, 09 Dec 2022 07:24:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-12-09T07:24:14Z</dc:date>
    <item>
      <title>Admin API's and Service Principal Authentication = 401 Unauthorized</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2957675#M40207</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have registered an azure app for my service principal, added it to an Azure Security group and added this group to my admin and non-admin api tenant developer settings. The app has been granted the correct API permissions for Power BI Service without any admin consent requirements (see below). I have added the group with admin permissions to all tenant workspaces. Via Powershell I can successfully authenticate using the service principal for non-admin api calls but everytime I attempt to call admin api calls, like the below, I receive "401 Unauthorized"?? Any help appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Invoke-PowerBIRestMethod&lt;/SPAN&gt; &lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;Url &lt;/SPAN&gt;&lt;SPAN&gt;'admin/groups?$top=100'&lt;/SPAN&gt; &lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;Method Get &lt;/SPAN&gt;&lt;SPAN&gt;|&lt;/SPAN&gt; &lt;SPAN&gt;ConvertFrom-Json&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 21:22:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2957675#M40207</guid>
      <dc:creator>powerbi_jenhen</dc:creator>
      <dc:date>2022-12-08T21:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Admin API's and Service Principal Authentication = 401 Unauthorized</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2958369#M40218</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315791" data-lia-user-login="powerbi_jenhen" class="lia-mention lia-mention-user"&gt;powerbi_jenhen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;According to the error code, it seems that you didn't get the proper permission to access Admin REST API. Please check if you enable the option&amp;nbsp;&lt;STRONG&gt;Allow service principals to use read-only Power BI admin APIs &lt;/STRONG&gt;under&amp;nbsp;&lt;STRONG&gt;Admin API settings&amp;nbsp;&lt;/STRONG&gt;in Admin portal.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/lb-lu/power-bi/enterprise/read-only-apis-service-principal-authentication" target="_self"&gt;Enable service principal authentication for read-only admin APIs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 07:24:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2958369#M40218</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-09T07:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Admin API's and Service Principal Authentication = 401 Unauthorized</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2959218#M40230</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. Yes, this option has been enabled for my security group but I still get the 401?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 13:47:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/2959218#M40230</guid>
      <dc:creator>powerbi_jenhen</dc:creator>
      <dc:date>2022-12-09T13:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Admin API's and Service Principal Authentication = 401 Unauthorized</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/3134240#M41753</link>
      <description>&lt;P&gt;I figured this out, my azure app permissions of type "Application" had "Admin consent", as described in the below article, this must be remove:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/lb-lu/power-bi/enterprise/read-only-apis-service-principal-authentication#how-to-check-if-your-app-has-admin-consent-required-permissions" target="_blank"&gt;Enable service principal authentication for read-only admin APIs - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:54:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-API-s-and-Service-Principal-Authentication-401/m-p/3134240#M41753</guid>
      <dc:creator>powerbi_jenhen</dc:creator>
      <dc:date>2023-03-15T17:54:04Z</dc:date>
    </item>
  </channel>
</rss>

