Forum Discussion

A111462's avatar
A111462
Regular Visitor
1 year ago
Solved

How to batch update CSV data source paths in deployed Power BI Report Server .pbix files?

Hi all, I'm currently working with Power BI Report Server and have over 300 deployed .pbix reports that connect to CSV files via UNC paths like:     \\hostnameA\folder\subfolder\file.csv I need to...
  • v-hashadapu's avatar
    v-hashadapu
    1 year ago

    Hi A111462 , Thank you for reaching out to the Microsoft Community Forum.

     

    The reason you're running into trouble with the REST API is that it doesn't support editing embedded data sources within .pbix files. Those connections are stored in a binary format inside a file called DataMashup (not DataModel and there’s no "Connections" file), which isn’t exposed through the API. So, any attempt to use /PowerBIReports(id)/DataSources on embedded sources results in a 400 error, this is expected behaviour. This limitation is documented by Microsoft and unfortunately doesn’t have a workaround using built-in tools alone.

     

    To solve this, you can use Tabular Editor, a lightweight, scriptable and supported tool in the Power BI ecosystem, to batch-edit M queries inside your .pbix files. With a small PowerShell script and a Tabular Editor command, you can programmatically open each report, search for old UNC paths in the query definitions, and replace them with the new path. This avoids the need to automate the Power BI Desktop UI.

     

    Once that update is complete, you should consider migrating your reports to use shared data sources, called .rsds files in Report Server. These allow connection strings and credentials to be managed independently of the report files. That means that if paths or credentials change again in the future, you can update a single .rsds file, via the web portal or the API, without touching hundreds of .pbix files again. This is the most sustainable way to manage data source connections at scale.

     

    Lastly, regarding credentials for embedded data sources, credentials cannot be set via the REST API. They're stored within the .pbix and must be configured in Power BI Desktop. However, .rsds files do support credential submission via the API, including Windows credentials or stored usernames/passwords. This is another reason why migrating to shared data sources is highly recommended for enterprise environments.

     

    If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.