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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. 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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.