Forum Discussion

aWalsh523's avatar
aWalsh523
New Member
3 years ago
Solved

Using PowerShell to get PowerBI SQL connection strings

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!

1 Reply

Replies have been turned off for this discussion