Forum Discussion

Alibek's avatar
Alibek
Frequent Visitor
3 years ago
Solved

Connecting to PowerBI Dataset from a PS Script: "The Connection String is not valid"

Hello!
When I try to connect to Power BI Dataset from Powershell Script, I get the following error:

 

Exception calling "Connect" with "1" argument(s): "The connection string is not valid."
At line:1 char:1
+ $serverConn.connect($connectionString)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ConnectionException

 

Code that I used:

$serverConn = New-Object Microsoft.AnalysisServices.Tabular.Server
$connectionString='Data source=powerbi://api.powerbi.com/v1.0/myorg/<workspace name>;Catalog=<dataset name>;User ID=<username>;Password=<password>'
$serverConn.Connect($connectionString)

2 Replies