Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ugoriuko
Frequent Visitor

Powershell - Retrieve List of Power BI reports and their respective datasource and/datagateway

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

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

 

View solution in original post

3 REPLIES 3
nino2009
New Member

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  

Anonymous
Not applicable

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

ugoriuko_0-1675705655559.png

 

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)

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.