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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors