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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.