<?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 dataset/report content via PowerShell in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/947253#M22474</link>
    <description>&lt;P&gt;Scenario/goal: Get content (a tile value and a table) from a PowerBI report via PowerShell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to query for a report or dataset`s content via the API, specifically using either the Invoke-PowerBIRestMethod or the generic Invoke-RestMethod in PowerShell?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My initial testing using the MicrosoftPowerBIMgmt PowerShell module:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Connect-PowerBIServiceAccount -Tenant $tenantId -Credential $AppCredential -ServicePrincipal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$Workspace = Get-PowerBIWorkspace -Name 'Test'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$Report = Get-PowerBIReport -Name 'Test Data Report' -Workspace $Workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$Url = "&lt;A href="https://api.powerbi.com/v1.0/myorg/reports/$($Report.Id.Guid)/pages" target="_blank"&gt;https://api.powerbi.com/v1.0/myorg/reports/$($Report.Id.Guid)/pages&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invoke-PowerBIRestMethod -Url $Url -Method Get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this only returns information about the reports pages – not the actual content/data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, I tried the Get-PowerBITable cmdlet, which according to the documentation &lt;EM&gt;Retrieves a list of Power BI tables in the dataset that match the specified search criteria&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, that was also not very successful:&lt;/P&gt;&lt;P&gt;Get-PowerBITable -DatasetId $Dataset.Id -WorkspaceId $Workspace.Id&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Get-PowerBITable : Operation returned an invalid status code 'NotFound'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both $DataSet and $Workspace is valid objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the dataset in the portal, there is a connection string looking like this:&lt;/P&gt;&lt;P&gt;powerbi://api.powerbi.com/v1.0/myorg/Test;initial catalog=Test Data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this can also be consumed somehow via PowerShell?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any pointers in the right direction to get the actual data from a dataset or report using PowerShell would be highly appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Feb 2020 07:23:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-02-26T07:23:31Z</dc:date>
    <item>
      <title>Get dataset/report content via PowerShell</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/947253#M22474</link>
      <description>&lt;P&gt;Scenario/goal: Get content (a tile value and a table) from a PowerBI report via PowerShell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to query for a report or dataset`s content via the API, specifically using either the Invoke-PowerBIRestMethod or the generic Invoke-RestMethod in PowerShell?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My initial testing using the MicrosoftPowerBIMgmt PowerShell module:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Connect-PowerBIServiceAccount -Tenant $tenantId -Credential $AppCredential -ServicePrincipal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$Workspace = Get-PowerBIWorkspace -Name 'Test'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$Report = Get-PowerBIReport -Name 'Test Data Report' -Workspace $Workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$Url = "&lt;A href="https://api.powerbi.com/v1.0/myorg/reports/$($Report.Id.Guid)/pages" target="_blank"&gt;https://api.powerbi.com/v1.0/myorg/reports/$($Report.Id.Guid)/pages&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invoke-PowerBIRestMethod -Url $Url -Method Get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this only returns information about the reports pages – not the actual content/data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, I tried the Get-PowerBITable cmdlet, which according to the documentation &lt;EM&gt;Retrieves a list of Power BI tables in the dataset that match the specified search criteria&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, that was also not very successful:&lt;/P&gt;&lt;P&gt;Get-PowerBITable -DatasetId $Dataset.Id -WorkspaceId $Workspace.Id&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Get-PowerBITable : Operation returned an invalid status code 'NotFound'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both $DataSet and $Workspace is valid objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the dataset in the portal, there is a connection string looking like this:&lt;/P&gt;&lt;P&gt;powerbi://api.powerbi.com/v1.0/myorg/Test;initial catalog=Test Data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this can also be consumed somehow via PowerShell?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any pointers in the right direction to get the actual data from a dataset or report using PowerShell would be highly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 07:23:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/947253#M22474</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T07:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get dataset/report content via PowerShell</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/955309#M22547</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;the APIs nor PS cmdlets are not there to extract data from Power BI. In your case I'd utilize reports subscriptions.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 13:39:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/955309#M22547</guid>
      <dc:creator>JirkaZ</dc:creator>
      <dc:date>2020-03-02T13:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get dataset/report content via PowerShell</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/955316#M22549</link>
      <description>&lt;P&gt;We eventually found the correct approach to achieve the goal in the mentioned scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote an article about the experience and how we solved it &lt;A href="http://www.powershell.no/power/bi,/powershell/2020/02/29/power-bi-powershell.html" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 13:42:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-dataset-report-content-via-PowerShell/m-p/955316#M22549</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-02T13:42:38Z</dc:date>
    </item>
  </channel>
</rss>

