Forum Discussion
how to fetch all Datasources for all Datasets
Hello, i am trying with the PowerShell apis but to no avail. i am looking for a way to retreive all the datasets and their underlying data sources for the whole organization. so i do not want to have to enter the DatasetID ot PowerBIDatasouce api.
anyhelp would be well appreciated
6 Replies
- AnonymousNot applicable
Not sure what you mean by "whole organisation" but my guess is all workspaces that your user has access to.
Get all datasets in your organization: https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.data/get-powerbidataset?view=powerbi-ps#examples (Example 2)
Loop through all datasets and get all datasources in each dataset: https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.data/get-powerbidatasource?view=powerbi-ps#examples (Example 2 if you only want datasources in your organization in the specified dataset)
You can call the REST api using Powershell , if you want to do that my suggestion would be to get all workspaces which you have access to:
https://docs.microsoft.com/en-us/rest/api/power-bi/groups/getgroups
Loop through all workspaces and for each workspace get all datasets :
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/getdatasetsingroup
And then for each dataset get all datasources :
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/getdatasourcesingroup
- AnonymousNot applicable
Hi thanks for your reply, so when i say 'whole organization' i actually mean the organization.
so it looks like i need to write some powershell script to loop through the results from one api, and add as a parameter to another api.
is that what you mean ?
ta
- AnonymousNot applicable
Okay, then yes I believe that is how you'll have to do it
- AnonymousNot applicable
Any update on that ?