Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
56 | |
20 | |
19 | |
18 | |
9 |