<?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 Get-PowerBIReport  :  Operation returned an invalid status code 'TooManyRequests' in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Get-PowerBIReport-Operation-returned-an-invalid-status-code/m-p/1239755#M24864</link>
    <description>&lt;P&gt;I'm using the PowerShell Script from&amp;nbsp;&lt;A href="https://insightsquest.com/2019/06/19/power-bi-artifact-to-workspace-relationships/," target="_blank" rel="noopener"&gt;https://insightsquest.com/2019/06/19/power-bi-artifact-to-workspace-relationships/,&lt;/A&gt;&amp;nbsp;using my userid/pw to return all workspaces, and reports.&amp;nbsp; essentially looping through all the workspaces to retrieve the reportname, reported, and workspace.&amp;nbsp; I am getting the output I would expect, but I'm not sure if all the reports are retrieved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$User = "userid@companyname"&lt;BR /&gt;$PW = "#useridpassword"&lt;/P&gt;&lt;P&gt;$SecPasswd = ConvertTo-SecureString $PW -AsPlainText -Force&lt;BR /&gt;$myCred = New-Object System.Management.Automation.PSCredential($User,$SecPasswd)&lt;/P&gt;&lt;P&gt;Login-PowerBIServiceAccount -Credential $myCred&lt;/P&gt;&lt;P&gt;$RetrieveDate = Get-Date&lt;/P&gt;&lt;P&gt;#1. Define output file paths&lt;/P&gt;&lt;P&gt;$BasePath = "C:\temp\New"&lt;/P&gt;&lt;P&gt;#Export Paths: Power BI Artifacts&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$WorkspacesPath = $BasePath + "Workspaces.csv"&lt;BR /&gt;$ReportsPath = $BasePath + "Reports.csv"&lt;/P&gt;&lt;P&gt;#2. Get active workspaces excluding personal workspaces ('My Workspace')&lt;BR /&gt;$ActiveWorkspaces = Get-PowerBIWorkspace -Scope Organization -All &amp;lt;#| Where-Object {$_.Type -ne "PersonalGroup" -and $_.State -eq "Active"} #&amp;gt; |`&lt;BR /&gt;Select-Object *, @{Name="DateRetrieved";Expression={$RetrieveDate}}&lt;/P&gt;&lt;P&gt;#3. Get reports in active workspaces but avoid duplicate reports (due to apps) and exclude usage metrics reports&lt;/P&gt;&lt;P&gt;$Reports = ForEach ($WS in $ActiveWorkspaces)&lt;BR /&gt;{&lt;BR /&gt;$WSID = $WS.Id&lt;BR /&gt;Get-PowerBIReport -Scope Organization -WorkspaceId $WSID | Where-Object {$_.Name -ne "Dashboard Usage Metrics Report" -and $_.Name -ne "Report Usage Metrics Report"} | `&lt;BR /&gt;Select-Object Name,DatasetId,@{Name="WorkspaceID";Expression={$WSID}},@{Name="DateRetrieved";Expression={$RetrieveDate}} | `&lt;BR /&gt;Sort-Object -Property Name,WorkspaceID | Get-Unique -AsString&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#4. Export out artifact objects to CSV files for reporting&lt;/P&gt;&lt;P&gt;$ActiveWorkspaces | Export-Csv $WorkspacesPath&lt;BR /&gt;$Reports | Export-Csv $ReportsPath&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jul 2020 22:42:16 GMT</pubDate>
    <dc:creator>rthomas</dc:creator>
    <dc:date>2020-07-21T22:42:16Z</dc:date>
    <item>
      <title>Get-PowerBIReport  :  Operation returned an invalid status code 'TooManyRequests'</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-PowerBIReport-Operation-returned-an-invalid-status-code/m-p/1239755#M24864</link>
      <description>&lt;P&gt;I'm using the PowerShell Script from&amp;nbsp;&lt;A href="https://insightsquest.com/2019/06/19/power-bi-artifact-to-workspace-relationships/," target="_blank" rel="noopener"&gt;https://insightsquest.com/2019/06/19/power-bi-artifact-to-workspace-relationships/,&lt;/A&gt;&amp;nbsp;using my userid/pw to return all workspaces, and reports.&amp;nbsp; essentially looping through all the workspaces to retrieve the reportname, reported, and workspace.&amp;nbsp; I am getting the output I would expect, but I'm not sure if all the reports are retrieved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$User = "userid@companyname"&lt;BR /&gt;$PW = "#useridpassword"&lt;/P&gt;&lt;P&gt;$SecPasswd = ConvertTo-SecureString $PW -AsPlainText -Force&lt;BR /&gt;$myCred = New-Object System.Management.Automation.PSCredential($User,$SecPasswd)&lt;/P&gt;&lt;P&gt;Login-PowerBIServiceAccount -Credential $myCred&lt;/P&gt;&lt;P&gt;$RetrieveDate = Get-Date&lt;/P&gt;&lt;P&gt;#1. Define output file paths&lt;/P&gt;&lt;P&gt;$BasePath = "C:\temp\New"&lt;/P&gt;&lt;P&gt;#Export Paths: Power BI Artifacts&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$WorkspacesPath = $BasePath + "Workspaces.csv"&lt;BR /&gt;$ReportsPath = $BasePath + "Reports.csv"&lt;/P&gt;&lt;P&gt;#2. Get active workspaces excluding personal workspaces ('My Workspace')&lt;BR /&gt;$ActiveWorkspaces = Get-PowerBIWorkspace -Scope Organization -All &amp;lt;#| Where-Object {$_.Type -ne "PersonalGroup" -and $_.State -eq "Active"} #&amp;gt; |`&lt;BR /&gt;Select-Object *, @{Name="DateRetrieved";Expression={$RetrieveDate}}&lt;/P&gt;&lt;P&gt;#3. Get reports in active workspaces but avoid duplicate reports (due to apps) and exclude usage metrics reports&lt;/P&gt;&lt;P&gt;$Reports = ForEach ($WS in $ActiveWorkspaces)&lt;BR /&gt;{&lt;BR /&gt;$WSID = $WS.Id&lt;BR /&gt;Get-PowerBIReport -Scope Organization -WorkspaceId $WSID | Where-Object {$_.Name -ne "Dashboard Usage Metrics Report" -and $_.Name -ne "Report Usage Metrics Report"} | `&lt;BR /&gt;Select-Object Name,DatasetId,@{Name="WorkspaceID";Expression={$WSID}},@{Name="DateRetrieved";Expression={$RetrieveDate}} | `&lt;BR /&gt;Sort-Object -Property Name,WorkspaceID | Get-Unique -AsString&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#4. Export out artifact objects to CSV files for reporting&lt;/P&gt;&lt;P&gt;$ActiveWorkspaces | Export-Csv $WorkspacesPath&lt;BR /&gt;$Reports | Export-Csv $ReportsPath&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 22:42:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-PowerBIReport-Operation-returned-an-invalid-status-code/m-p/1239755#M24864</guid>
      <dc:creator>rthomas</dc:creator>
      <dc:date>2020-07-21T22:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get-PowerBIReport  :  Operation returned an invalid status code 'TooManyRequests'</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-PowerBIReport-Operation-returned-an-invalid-status-code/m-p/1240758#M24869</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/96518"&gt;@rthomas&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The 'too many requests' status code would suggest that the API rate limiting is stopping you from getting a complete set of responses. It might be worth trying a short pause within the loop before you call 'Get-PowerBI-Report'&lt;BR /&gt;&lt;BR /&gt;You can get PowerShell to pause by using the 'Start-Sleep' command.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Start-Sleep -Seconds 60&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not suggesting you use 60 seconds between calls. A couple of seconds should probably do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers, Matt&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 08:14:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-PowerBIReport-Operation-returned-an-invalid-status-code/m-p/1240758#M24869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-22T08:14:06Z</dc:date>
    </item>
  </channel>
</rss>

