<?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 Status code 400 (bad request) on some Admin API calls in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2912520#M39794</link>
    <description>&lt;P&gt;I've been getting a bad request calls to two of the admin APIs, GetGroupsAsAdmin and GetAppsAsAdmin, despite making calls in line with what the documentation (&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin&lt;/A&gt;) says.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can make calls successfully to other admin APIs (e.g. dataflows and datasets). The difference with these two seems to be that they both have mandatory $top parameters, but I get the error whether or not I supply this parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Connect-PowerBIServiceAccount
Invoke-PowerBIRestMethod -Method Get -Url "https://api.powerbi.com/v1.0/myorg/admin/groups?$top=10"
$Error[$Error.Count - 1].Exception.InnerException&lt;/LI-CODE&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="JoshT_0-1668685418845.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/824909i1801805504AC6E01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoshT_0-1668685418845.png" alt="JoshT_0-1668685418845.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've connected both as a tenant admin and as a service principal with the admin scope allowed and not had success with either. Are these APIs broken or am I doing something wrong?&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2022 11:54:00 GMT</pubDate>
    <dc:creator>JoshT</dc:creator>
    <dc:date>2022-11-17T11:54:00Z</dc:date>
    <item>
      <title>Status code 400 (bad request) on some Admin API calls</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2912520#M39794</link>
      <description>&lt;P&gt;I've been getting a bad request calls to two of the admin APIs, GetGroupsAsAdmin and GetAppsAsAdmin, despite making calls in line with what the documentation (&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin&lt;/A&gt;) says.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can make calls successfully to other admin APIs (e.g. dataflows and datasets). The difference with these two seems to be that they both have mandatory $top parameters, but I get the error whether or not I supply this parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Connect-PowerBIServiceAccount
Invoke-PowerBIRestMethod -Method Get -Url "https://api.powerbi.com/v1.0/myorg/admin/groups?$top=10"
$Error[$Error.Count - 1].Exception.InnerException&lt;/LI-CODE&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="JoshT_0-1668685418845.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/824909i1801805504AC6E01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoshT_0-1668685418845.png" alt="JoshT_0-1668685418845.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've connected both as a tenant admin and as a service principal with the admin scope allowed and not had success with either. Are these APIs broken or am I doing something wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 11:54:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2912520#M39794</guid>
      <dc:creator>JoshT</dc:creator>
      <dc:date>2022-11-17T11:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Status code 400 (bad request) on some Admin API calls</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2913260#M39803</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/141744"&gt;@JoshT&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check this:&lt;/P&gt;&lt;H2&gt;Permissions&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.&lt;/LI&gt;&lt;LI&gt;Delegated permissions are supported.&lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;Required Scope&lt;/H2&gt;&lt;P&gt;Tenant.Read.All or Tenant.ReadWrite.All&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 16:24:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2913260#M39803</guid>
      <dc:creator>Habitat</dc:creator>
      <dc:date>2022-11-17T16:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Status code 400 (bad request) on some Admin API calls</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2914823#M39817</link>
      <description>&lt;P&gt;Yes, sorry, by tenant admin I meant Power BI service admin, and the service principal I'm using as an alternative has the necessary scope - as I said, other admin APIs work fine, it's just the groups and apps ones that don't work under any circumstances, with any of the parameters specified as per documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 12:37:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2914823#M39817</guid>
      <dc:creator>JoshT</dc:creator>
      <dc:date>2022-11-18T12:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Status code 400 (bad request) on some Admin API calls</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2922352#M39895</link>
      <description>&lt;P&gt;Using fiddler, found out that $top parameter wasn't being sent - the dollar sign required for the parameter name meant PowerShell was pulling in a session variable that didn't exist (so the uri would have been "&lt;SPAN&gt;&lt;A href="https://api.powerbi.com/v1.0/myorg/admin/groups?=10" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.powerbi.com/v1.0/myorg/admin/groups?=10&lt;/A&gt;"&amp;nbsp;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The correct syntax is as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Invoke-PowerBIRestMethod -Method Get -Url "https://api.powerbi.com/v1.0/myorg/admin/groups?`$top=10"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess that's the problem with using the PowerShell ISE, string and variable are highlighted in only slightly different shades of brown!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 17:27:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Status-code-400-bad-request-on-some-Admin-API-calls/m-p/2922352#M39895</guid>
      <dc:creator>JoshT</dc:creator>
      <dc:date>2022-11-22T17:27:11Z</dc:date>
    </item>
  </channel>
</rss>

