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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.