Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello All,
I am trying to build a PowerShell Script to list all the reports in my tenant, the gateways they use and/or their respective datasources
More like a join between Get-PowerBIReport and Get-DataGatewayDatasource on either ReportID or DatasetID.
Is there an existing module or powershell script that can do that?
I have over 200 reports and think its too much to manually review and update their datasources post migrationas I have no idea how many are going to be affected.
Thanks for your assistance
Solved! Go to Solution.
Hi @ugoriuko ,
Check the link below:
Reports - Get Report - REST API (Power BI Power BI REST APIs) | Microsoft Docs
THis API will tell you which data sources are for which datasets. It also contains the GatewayID which will relate to your Gateway.
Admin - Datasets GetDatasourcesAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Docs
This will give you the Gateway details:
Gateways - Get Gateways - REST API (Power BI Power BI REST APIs) | Microsoft Docs
This one might be the one to update the data sources
Datasets - Update Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
If it still does not help, please provide more details with the error.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
very good attempt. I hope you can add more to this statement as I really need to get reports that are connected to each gateway so we can do analysis for our data sources.
thank you
Hi @ugoriuko ,
Check the link below:
Reports - Get Report - REST API (Power BI Power BI REST APIs) | Microsoft Docs
THis API will tell you which data sources are for which datasets. It also contains the GatewayID which will relate to your Gateway.
Admin - Datasets GetDatasourcesAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Docs
This will give you the Gateway details:
Gateways - Get Gateways - REST API (Power BI Power BI REST APIs) | Microsoft Docs
This one might be the one to update the data sources
Datasets - Update Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
If it still does not help, please provide more details with the error.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello Polly,
Thanks for the feedback.
I am trying to take this a step further by doing a join
I however am unable to map the Get-PowerBIReport outer query to the Get-PowerBIDatasource for each loop result for each DatasetId
PS Query: $fields = echo id, name, DatasetId;
Get-PowerBIReport | Select id, name, DatasetId |
Foreach {(Get-PowerBIDatasource -DatasetId $_.DatasetId )} | Select-object (echo $fields DatasourceType GatewayId DatasourceId)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!