Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Looking for an automated way to identify all SQL sources for a PowerBI dataset. Would like a way in PowerShell to get a list of connections for a PowerBI Dataset, then for each connection get the SQL statement (query text found under the 'Advanced Options' in PBI desktop). Shown here in red:
I've tried MicrosoftPowerBIMgmt Get-PowerBIDatasource function as well as the Power BI REST API for Get Datasources. These both include the 'server' and 'database' fields that are found on the connection setup screen, but do not include the actual query text.
Alternately, if a connection does not include SQL query text, would there be a way to access the 'Navigate' step in the 'Applied Steps'?
From the SQL query text or text from the 'Navigate' step I can then parse the text as needed.
Any help or suggestions would be appreciated!
Solved! Go to Solution.
Hi @aWalsh523,
AFAIk, current you can't directly get the advanced SQL statement from the data connector by rest API.
It should be more suitable to trace these on the database side or you can consider parameterized t-sql string with query parameters, then you can use the rest API to get query parameters to get detailed t-sql queries.
Using the Power BI Service Parameters to change connection strings (To possibly change between Dev
let
source=Sql.Database("server", "database",[Query=SQLParameter])
in
source
Datasets - Get Parameters - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Xiaoxin Sheng
Hi @aWalsh523,
AFAIk, current you can't directly get the advanced SQL statement from the data connector by rest API.
It should be more suitable to trace these on the database side or you can consider parameterized t-sql string with query parameters, then you can use the rest API to get query parameters to get detailed t-sql queries.
Using the Power BI Service Parameters to change connection strings (To possibly change between Dev
let
source=Sql.Database("server", "database",[Query=SQLParameter])
in
source
Datasets - Get Parameters - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Xiaoxin Sheng
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |