Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
How can I change the SQL database server, database name and credential of a published report?
By published the report from SQL server credential and implement parameterized Sql server and Sql DB name , we can able to change DB name parameter by calling PowerBI APIs , but how I can change Sever Name?
I have tried "Default.UpdateDatasources" but its change only server name and DB name , not its credential ?
Please help me out as early as possible
TIA
Paritosh Mishra
Solved! Go to Solution.
Its solve by first DB server and DB name then calling "Default.UpdateDatasources"
then by calling "gateways/$gatewayId/datasources/$datasourceId"
Thanks
I have changed the DB server and its credential only to those which I had recently inputs on Power BI Web .May be DB credential are kept in caches .
If I have used new DB server and its credential , then only DB server and DB name changes .Password changed script thow error "The remote server returned an error: (400) Bad Request"
This is my code of password change .
I am not using Gateway.
########## Change Password #########
$datasourePatchUrl = "https://api.powerbi.com/v1.0/myorg/gateways/$gatewayId/datasources/$datasourceId"
$patchBody = @{
"credentialDetails" = @{
"credentials" = "{""credentialData"":[{""name"":""username"",""value"":""$sqlUserName""},{""name"":""password"",""value"":""$sqlUserPassword""}]}"
"credentialType" = "Basic"
"encryptedConnection" = "NotEncrypted"
"encryptionAlgorithm" = "None"
"privacyLevel" = "Organizational"
}
}
$patchBodyJson = ConvertTo-Json -InputObject $patchBody -Depth 6 -Compress
$response = Invoke-RestMethod -Uri $datasourePatchUrl –Headers $auth_header -Body $patchBodyJson –Method PATCH
########## Change Password #########
So my queries are
1. How this changes password script run successfully even in new DB server
2. How the Power BI online caches (where Db credential stored) delete .
Please help me out
TIA
Its solve by first DB server and DB name then calling "Default.UpdateDatasources"
then by calling "gateways/$gatewayId/datasources/$datasourceId"
Thanks
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 14 | |
| 13 | |
| 8 | |
| 7 |
| User | Count |
|---|---|
| 41 | |
| 41 | |
| 34 | |
| 29 | |
| 24 |