Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Invoke-PowerBIRestMethod : One or more errors occurred.
At C:\Users\---\Desktop\*******\******\PowerShell\FinalCode\File1.ps1:184 char:1
+ Invoke-PowerBIRestMethod -Url $CreateDatasourceUrl -Method Post -Body ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod
Invoke-PowerBIRestMethod : Encountered errors when invoking the command: {
"code": "DMTS_UnsupportedConnectionStringError",
"pbi.error": {
"code": "DMTS_UnsupportedConnectionStringError",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
At C:\Users\chaudman\Desktop\TampereProject\sarika\PowerShell\FinalCode\File1.ps1:184 char:1
+ Invoke-PowerBIRestMethod -Url $CreateDatasourceUrl -Method Post -Body ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], Exception
+ FullyQualifiedErrorId : Encountered errors when invoking the command: {
"code": "DMTS_UnsupportedConnectionStringError",
"pbi.error": {
"code": "DMTS_UnsupportedConnectionStringError",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
},Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod
I am not sure, just wanted to create 'Folder' as a data source connection under on-primese Gateway using power shell script, could you please suggest,
$datasourceType = "Folder"
$GatewayId = ""
$CreateDatasourceUrl = "https://api.powerbi.com/v1.0/myorg/gateways/$GatewayId/datasources"
$encryptedCredentials = EncryptWindowsCredentials -Username $username -PasswordAsString $password -GatewayExponent $gatewayExponent -GatewayModulus $gatewayModulus
$credentialsObject = $encryptedCredentials | ConvertFrom-Json
$credentialDetails = $credentialsObject.credentialDetails
$Body = @{
"datasourceType"=$datasourceType
"connectionDetails"='{"full path":"\\WPF3HPGEK\Users\chaudman\Desktop\TP\arika\PowerShell\"}' #'{"server":"WPF3HPGEK","database":"DemoDb"}'#'{"server":"<serverName>","database":"<DBName>"}'
"datasourceName"=$datasourceName
"credentialDetails" = @{
"credentialType" = $credentialDetails.credentialType
"credentials" = $credentialDetails.credentials
"encryptedConnection" = $credentialDetails.encryptedConnection
"encryptionAlgorithm" = $credentialDetails.encryptionAlgorithm
"privacyLevel" = $credentialDetails.privacyLevel
}
}
$bodyJson = $body | ConvertTo-Json
Invoke-PowerBIRestMethod -Url $CreateDatasourceUrl -Method Post -Body $bodyJson
Try it out in the sandbox. Make sure the gateway can see your share.
Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Does it work in the API sandbox?
It is not working, Could you please suggest
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
25 | |
19 | |
18 | |
14 | |
11 |
User | Count |
---|---|
32 | |
20 | |
19 | |
18 | |
11 |