Forum Discussion
GetScanResult endpoint does not return "datasourceInstances" list
- 3 months ago
Hi 1ng4lipt ,
Thank you for providing the detailed request flow. I have reviewed your implementation, and your PostWorkspaceInfo call appears to be correct. so the parameters are set appropriately. The use of true versus True will not affect the response in this context.
Notably, your scan result returns datasourceUsages with a valid datasourceInstanceId, indicating that the scan is successfully identifying the relationship between the dataset and its datasource. If there were an issue with the request, this information would typically not be present.
The absence of the datasourceInstances section generally occurs when the scan API cannot fully resolve the underlying datasource metadata. As outlined in the Microsoft documentation for GetScanResult, the API may only return certain properties depending on the metadata available in the Power BI service. As a result, the response can vary based on datasource type, connection configuration, gateway setup, or how the dataset was created.
This behavior is common with specific cloud connections, custom connectors, parameterized connections, dataflows, and certain Fabric related sources where the relationship is detected, but complete datasource details are not provided in the scan response.
Since your request is properly configured and the scan completes successfully, this appears to be related to the API’s metadata return for that datasource, rather than an issue with your code.
If you require comprehensive datasource connection details, I recommend using the Get Datasources As Admin endpoint, which is generally more reliable when datasourceInstances is missing.
For further reference, please see the following Microsoft documentation:
GetScanResult API documentation
https://learn.microsoft.com/rest/api/power-bi/admin/workspace-info-get-scan-resultPostWorkspaceInfo API documentation
https://learn.microsoft.com/rest/api/power-bi/admin/workspace-info-post-workspace-infoGet Datasources As Admin documentation
https://learn.microsoft.com/rest/api/power-bi/admin/datasets-get-datasources-as-admin
Thank you.
Hello lbendlin ,
Unfortunately, these settings did not resolve the problem, 'datasourceInstances' list still missing. Still, appreciate your help.
v-tejrama lbendlin do you think there are some other possibilities to get 'datasourceInstances' data, not only from Get Datasources As Admin endpoint? I'm interesting in "datasourceType" and "connectionString" keys
I have ~4000 datasets across tenant and it would be a nightmare to wait >12 hours (with current endpoint limitations) to get all data.
- v-tejrama3 months agoCommunity Support
Hi 1ng4lipt ,
Your API request and parameters are correctly configured, and the fact that datasourceUsages is returning valid datasourceInstanceId values indicates that the scan is functioning as intended. Since enabling the admin settings did not impact the response, the absence of datasourceInstances is likely due to how the scan backend provides metadata for specific datasource or connector types, rather than an issue with your implementation.
This situation often occurs with certain cloud, Fabric, custom, or gatewaymbased connections where Power BI recognizes the datasource relationship but does not supply the complete datasource definition. Currently, GetDatasourcesAsAdmin is the most dependable method for retrieving datasource metadata such as datasourceType and connection details. For larger environments, it is standard practice to enhance the collection process through batching or parallel execution to minimize runtime.
Thank you.