Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DimitraG
Frequent Visitor

API to Change RDL's Datasource

Hello everyone,

 

I'm currently facing an issue with an RDL file uploaded to a workspace.

Within the same GatewayID, there are two different connections available: one using SSO and the other using Windows Authentication.


Both connections point to the same server and database.

 

I need an API that allows me to Update the data source used by the RDL between these connections.

Does anyone know how I can achieve this?

 

I am using this but doesnt work Reports - Bind To Gateway In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Import-Module MicrosoftPowerBIMgmt
Connect-PowerBIServiceAccount
$accessToken = Get-PowerBIAccessToken
$reportId="12234"
$groupId = "32142"
$gatewayobjectId ="11111"
$dataSourceObjectId = "22222"
$uri = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/reports/$reportId/Default.BindToGateway"
 
 
$bindDetails = @(
    @{
        datasourceName = "DataSource"
        dataSourceObjectId = $dataSourceObjectId
    }
)
 
$headers = @{
    Authorization =  ($accessToken.Authorization)
    ContentType = "application/json"
}
 
$body = @{
    gatewayObjectId = $gatewayobjectId 
    bindDetails= $bindDetails
  } | ConvertTo-Json -Depth 3
 
   
Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -Body $body
 
 
Thank you!
1 REPLY 1
Anonymous
Not applicable

Hi @DimitraG ,

 

You might consider directly managing data sources within the Power BI service by configuring SSO and Windows Authentication as two separate data sources. This setup would allow you to switch between them by adjusting the dataSourceObjectId parameter in the BindToGateway API as needed.

 

Best Regards,

Bof

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.