<?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: GetDatasourcesAsAdmin Powershell help in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1654087#M27753</link>
    <description>&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2021 08:25:38 GMT</pubDate>
    <dc:creator>nkasdali</dc:creator>
    <dc:date>2021-02-09T08:25:38Z</dc:date>
    <item>
      <title>GetDatasourcesAsAdmin Powershell help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1646412#M27688</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I need your help to build this ForEach loop,&amp;nbsp;unfortunately i'm not familiar with PowerShell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First API call helps me to get all my datasets, then, i have to passe the "id" of each one to the datasource APi call :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;################## GET Datasets DATA###########################################
Write-Host("Getting datasets data.....")
$DatasetsApi = 'https://api.powerbi.com/v1.0/myorg/admin/datasets?$top=2'
$DatasetsCall = Invoke-PowerBIRestMethod -Url $DatasetsApi -Method Get 

################## GET Datasources DATA###########################################
ForEach ($DatasetsCall in $DatasetsCall)
{
$DatasourceApi = 'https://api.powerbi.com/v1.0/myorg/admin/datasets/&amp;amp;'+$DatasetsCall.id+'&amp;amp;/datasources'

$DatasourceCall = Invoke-PowerBIRestMethod -Url $DatasourceApi -Method Get 
$DatasourceCall

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 22:17:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1646412#M27688</guid>
      <dc:creator>nkasdali</dc:creator>
      <dc:date>2021-02-04T22:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: GetDatasourcesAsAdmin Powershell help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1647840#M27694</link>
      <description>&lt;P&gt;Up &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 12:15:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1647840#M27694</guid>
      <dc:creator>nkasdali</dc:creator>
      <dc:date>2021-02-05T12:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: GetDatasourcesAsAdmin Powershell help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1653769#M27747</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/43163"&gt;@nkasdali&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try this.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;################## GET Datasets DATA###########################################
Write-Host("Getting datasets data.....")
$DatasetsApi = 'https://api.powerbi.com/v1.0/myorg/admin/datasets?$top=2'
$DatasetsCall = Invoke-PowerBIRestMethod -Url $DatasetsApi -Method Get 

################## GET Datasources DATA###########################################
ForEach ($DatasetsCall in $DatasetsCall)
{
    $DatasourceApi = "https://api.powerbi.com/v1.0/myorg/admin/datasets/" + $DatasetsCall.Id + "/datasources"
    $DatasourceCall = Invoke-PowerBIRestMethod -Url $DatasourceApi -Method Get 
    $DatasourceCall

}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Lionel Chen&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 05:57:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1653769#M27747</guid>
      <dc:creator>v-lionel-msft</dc:creator>
      <dc:date>2021-02-09T05:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: GetDatasourcesAsAdmin Powershell help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1654087#M27753</link>
      <description>&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 08:25:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/GetDatasourcesAsAdmin-Powershell-help/m-p/1654087#M27753</guid>
      <dc:creator>nkasdali</dc:creator>
      <dc:date>2021-02-09T08:25:38Z</dc:date>
    </item>
  </channel>
</rss>

