Forum Discussion
Update Dataset Connections using Power BI APIs
- 1 year ago
Your JSON request body should look like this:
{ "updateDetails": [ { "datasourceType": "Sql", "connectionDetails": { "database": "NAME_OF_DATABASE", "server": "NAME_OF_SERVER.database.windows.net" }, "datasourceId": "XYZ123" } ] }For cloud sources like Azure SQL Database, leave this field empty or remove it. The API does not require a gateway for cloud connections.
PowerShell Script:
# Parameters $workspaceId = "YOUR_WORKSPACE_ID" $datasetId = "YOUR_DATASET_ID" $url = "https://api.powerbi.com/v1.0/myorg/groups/$workspaceId/datasets/$datasetId/Default.UpdateDatasources" # Connection Details $ConnectionDetailsObject = @{ updateDetails = @( @{ datasourceType = "Sql" connectionDetails = @{ database = "NAME_OF_DATABASE" server = "NAME_OF_SERVER.database.windows.net" } } ) } # Convert to JSON and Make the API Call Invoke-PowerBIRestMethod -Url $url -Method Post -Body ($ConnectionDetailsObject | ConvertTo-Json -Depth 10) -ContentType "application/json"If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Hi LJonesStripe ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Thanks and regards
Hi v-nmadadi-msft, no the solutions provided did not work. I had a support case with Microsoft open for a long time. But what I am currently trying to do is not technically possible at this time via the API.
This support issue can be closed. Thank you for your help
- v-nmadadi-msft1 year agoCommunity Support
Hi LJonesStripe ,
We really appreciate your efforts and thank you for letting us know the update on the issue.
Please continue using fabric community forum for any further assistance.
Thanks and Regards