<?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: Unauthorized 401 when accessing Power BI Admin API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4012710#M53743</link>
    <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/756215"&gt;@novirae&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the error message, 401 Unauthorized error usually indicates a problem with authentication or permissions, you can check if the tenant settings are turned on in the following official documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/admin/service-admin-portal-admin-api-settings" target="_blank" rel="noopener"&gt;Admin API admin settings - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/53819540/status-unauthorized-401-error-while-getting-the-reports-from-the-workspace" target="_blank" rel="noopener"&gt;azure - Status: Unauthorized (401) error while getting the reports from the workspace - Stack Overflow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is the related document, you can view this content:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-401-Authorization-error-when-using-Service/m-p/627827" target="_blank" rel="noopener"&gt;Solved: Power Bi REST API - 401 Authorization error when u... - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/troubleshoot-rest-api" target="_blank" rel="noopener"&gt;Troubleshoot Power BI REST APIs - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-401-Authorization-error-when-using-app-secret/m-p/588468" target="_blank" rel="noopener"&gt;Solved: Power Bi REST API - 401 Authorization error when u... - Microsoft Fabric Community&lt;/A&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>Thu, 27 Jun 2024 06:31:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-27T06:31:37Z</dc:date>
    <item>
      <title>Unauthorized 401 when accessing Power BI Admin API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4010610#M53721</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have a Service Principal that we want to use to do bunch of Administrative tasks in PBI Service like archiving unused reports etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've created an App Registration on Azure side and I'm successfully able to use it to generate an Access Token&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="novirae_0-1719384374154.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1122331i66D7F29472D754E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="novirae_0-1719384374154.png" alt="novirae_0-1719384374154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using token in a regular API calls I'm getting some data back&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="novirae_1-1719384483294.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1122334i56BF2E15CD807FE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="novirae_1-1719384483294.png" alt="novirae_1-1719384483294.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when using this token in Admin API calls I'm getting 401 Unauthorized&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="novirae_2-1719384508016.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1122336iB2A5E6CD350B1154/image-size/medium?v=v2&amp;amp;px=400" role="button" title="novirae_2-1719384508016.png" alt="novirae_2-1719384508016.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've attempted two things:&lt;/P&gt;&lt;P&gt;1. Assigning all Power BI Service related API permissions like "Dataset.ReadWrite.All", "Tenant.ReadWrite.All" etc. in App Registration itself (ignore red line on screenshot :D)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="novirae_3-1719384613493.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1122340i53047A4167A3BA5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="novirae_3-1719384613493.png" alt="novirae_3-1719384613493.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Assigning Service Principal to "Fabric Administrator role"&amp;nbsp; (before doing that we've removed all API permissions as noted here &lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin" target="_blank"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin&lt;/A&gt; "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.")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="novirae_4-1719384819167.png" style="width: 707px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1122342iC320592A8737370C/image-dimensions/707x244?v=v2" width="707" height="244" role="button" title="novirae_4-1719384819167.png" alt="novirae_4-1719384819167.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both scenarios neted the same result - 401 Unauthorized.&lt;/P&gt;&lt;P&gt;SP is part of a group that is listed under "Service Principals that can use Fabric APIs". Under same group we have ADF SP that we're using to run Dataset refreshes and this is working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 07:00:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4010610#M53721</guid>
      <dc:creator>novirae</dc:creator>
      <dc:date>2024-06-26T07:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unauthorized 401 when accessing Power BI Admin API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4012710#M53743</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/756215"&gt;@novirae&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the error message, 401 Unauthorized error usually indicates a problem with authentication or permissions, you can check if the tenant settings are turned on in the following official documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/admin/service-admin-portal-admin-api-settings" target="_blank" rel="noopener"&gt;Admin API admin settings - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/53819540/status-unauthorized-401-error-while-getting-the-reports-from-the-workspace" target="_blank" rel="noopener"&gt;azure - Status: Unauthorized (401) error while getting the reports from the workspace - Stack Overflow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is the related document, you can view this content:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-401-Authorization-error-when-using-Service/m-p/627827" target="_blank" rel="noopener"&gt;Solved: Power Bi REST API - 401 Authorization error when u... - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/troubleshoot-rest-api" target="_blank" rel="noopener"&gt;Troubleshoot Power BI REST APIs - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-401-Authorization-error-when-using-app-secret/m-p/588468" target="_blank" rel="noopener"&gt;Solved: Power Bi REST API - 401 Authorization error when u... - Microsoft Fabric Community&lt;/A&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>Thu, 27 Jun 2024 06:31:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4012710#M53743</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-27T06:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Unauthorized 401 when accessing Power BI Admin API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4322279#M58631</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/756215"&gt;@novirae&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this post was a few months ago, but I am stuck trying to do something very similar to what you were doing.&amp;nbsp; I am trying to just query info from the PBI Admin API instead of updating reports/workspaces, but I am not able to get past the 401 error on the Admin API.&amp;nbsp; I granted the Graph and Power BI Tenant permissions and added the App Registration as a Fabric Admin.&amp;nbsp; All 4 of the Tenant Settings are turned on and the App Registration is in the Security group on the Tenant settings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Were you ever able to solve this and connect to the Power BI Admin API with an App Registration?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&amp;nbsp; I read each of the articles in the Solution, but none were helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Seth&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 17:56:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4322279#M58631</guid>
      <dc:creator>SethParker</dc:creator>
      <dc:date>2024-12-10T17:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unauthorized 401 when accessing Power BI Admin API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4322394#M58634</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/646141"&gt;@SethParker&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;No. We weren't able to get past it at least in a way I'd love to. After some later testing, discussions, posting on different sites I came to a conclusion that this is indeed a bug / not implemented feature for multiple reasons (maybe including security?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What seemed to be working was generating REST API token using grant_type = password instead of client_credentials, but that forces you to specify Entra ID username/password (and that username ideally wouldn't have MFA enabled, which is a very strict no-go for us).&lt;/P&gt;&lt;P&gt;We ended up with named (per user) administrative-like account that has MFA enabled and we use that in Powershell script (using Connect-PowerBIServiceAccount) to assign access to workspaces.&lt;/P&gt;&lt;P&gt;After that we use the App Registration to do administrative tasks like removing old reports / archiving them to Blob Storage etc. that can be done per workspace level&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 19:48:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4322394#M58634</guid>
      <dc:creator>novirae</dc:creator>
      <dc:date>2024-12-10T19:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Unauthorized 401 when accessing Power BI Admin API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4328343#M58672</link>
      <description>&lt;P&gt;Thank you for your response!&amp;nbsp; I agree that this seems to be a bug.&amp;nbsp; We are trying to query Activity History (and a couple of other tables) from the Admin API, so I don't know of another way to get to that data with an App Registration.&amp;nbsp; A non-MFA user with access to the Admin API is a non-starter for us as well.&amp;nbsp; Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 16:37:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4328343#M58672</guid>
      <dc:creator>SethParker</dc:creator>
      <dc:date>2024-12-13T16:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Unauthorized 401 when accessing Power BI Admin API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4332521#M58708</link>
      <description>&lt;P&gt;You shouldn't have any issue querying read only APIs (like activity history, list of workspaces / datasets / reports) etc - we have entire monitoring solution based on that data that are getting retrieved by service principal/app registration. The only thing we weren't able to get working is using POST requests (like add access to workspace) via App Registration - rest works perfectly fine&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 07:58:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unauthorized-401-when-accessing-Power-BI-Admin-API/m-p/4332521#M58708</guid>
      <dc:creator>novirae</dc:creator>
      <dc:date>2024-12-17T07:58:48Z</dc:date>
    </item>
  </channel>
</rss>

