Forum Discussion
How to find reports/semantic models bound to a Gateway Connection
Hi Community,
I'm trying to generate a list of reports/semantic models that are using a specific gateway connection in Power BI.
So far, I've experimented with the Power BI REST APIs but haven't been successful. I've used the following endpoints:
What I'm missing is the link between the gatewayId connections and the datasets that depend on them.
Could someone point me in the right direction or share how to establish this connection? Any guidance would be greatly appreciated. Thanks so much!
Hi ogureisuo , Thank you for reaching out to the Microsoft Community Forum.
No, there’s no single Power BI REST call that returns all dataset datasources tenant-wide without a {datasetId}. The GetDatasources/GetDatasourcesAsAdmin endpoints require a dataset identifier, so the supported pattern is to list datasets (tenant or workspace scope) and then call the per dataset datasources endpoint for each one; only then can you map datasourceId/gatewayId/connectionDetails back to gateway resources. Calling GET /gateways/{gatewayId}/datasources will show gateway side datasource entries, but it won’t tell you which datasets reference them, you still need the dataset side calls to establish the link.
Datasets - Get Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Datasets - Get Datasets - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Admin - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Admin - Datasets GetDatasourcesAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn
5 Replies
- v-hashadapu
Community Support
Hi ogureisuo , Thank you for reaching out to the Microsoft Community Forum.
Look at the datasources of each dataset, not the gateway itself. For every dataset in a workspace, call GET /groups/{groupId}/datasets/{datasetId}/datasources. That response tells you exactly which gateway and which gateway-datasource a dataset depends on, because it returns the dataset’s datasourceId, its gatewayId, and the full connectionDetails. Then, from the gateway side, call GET /gateways/{gatewayId}/datasources to list the datasource IDs and their server/database/URL details.
Once you have both sides, the match is straightforward, the most reliable way is comparing the dataset’s datasourceId with the gateway’s datasource id. If that matches, that dataset (and therefore any report built on it) is using that gateway. When the ID isn’t present or doesn’t line up, confirm by checking whether the dataset’s gatewayId equals the gateway you are inspecting or by comparing the connectionDetails field when small differences exist (like hostname vs IP).
If you need to do this across your whole tenant, you can avoid looping manually by using the Admin versions of the dataset-datasources APIs, which give you a tenant-wide list as long as you have Fabric/Power BI admin rights. To call any of these APIs, make sure your app or account has the correct permissions, dataset datasource calls require Dataset.Read.All and gateway calls require being an admin on that gateway.
Datasets - Get Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Gateways - Get Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Admin - Datasets GetDatasourcesAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Datasets - Bind To Gateway - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Admin - Datasets GetDatasetsAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn
- ogureisuo
Helper I
v-hashadapu, Thanks for your help! I have a little problem.. Is there a way to generate all the datasources without entering the datasetid?
https://api.powerbi.com/v1.0/myorg/admin/datasets/{datasetId}/datasources
- v-hashadapu
Community Support
Hi ogureisuo , Thank you for reaching out to the Microsoft Community Forum.
No, there’s no single Power BI REST call that returns all dataset datasources tenant-wide without a {datasetId}. The GetDatasources/GetDatasourcesAsAdmin endpoints require a dataset identifier, so the supported pattern is to list datasets (tenant or workspace scope) and then call the per dataset datasources endpoint for each one; only then can you map datasourceId/gatewayId/connectionDetails back to gateway resources. Calling GET /gateways/{gatewayId}/datasources will show gateway side datasource entries, but it won’t tell you which datasets reference them, you still need the dataset side calls to establish the link.
Datasets - Get Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Datasets - Get Datasets - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Admin - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Admin - Datasets GetDatasourcesAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn
- v-hashadapu
Community Support
Hi ogureisuo , Hope you are doing well. Kindly let us know if the issue has been resolved or if further assistance is needed. Your input could be helpful to others in the community.
- v-hashadapu
Community Support
Hi ogureisuo , Hope you're doing fine. Can you confirm if the problem is solved or still persists? Sharing your details will help others in the community.