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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Update Datasource in Paginated report using Power BI

Hi DEVs,

 

I need to update datasource of paginated reports using PBI Dataset from DEV workspace's dataset to PROD workspace's dataset

 

There are 100+ paginated reports and it's hard to update the datasource to PROD dataset everytime deploying to Production workspace

 

Is there's any way I can update programatically using Python or PowerShell?

2 ACCEPTED SOLUTIONS
v-yiruan-msft
Community Support
Community Support

Hi @LakshtSharma99 ,

To change the data source of a paginated report programmatically, you can use the Power BI REST API. Here are the high-level steps you can follow:

  1. Get the report ID of the paginated report you want to modify.
  2. Get the data source ID of the dataset you want to modify.
  3. Modify the connection string of the data source using the Power BI REST API.
  4. Update the data source of the dataset using the Power BI REST API.
  5. Update the report using the Power BI REST API.

Here are some references that can help you with the implementation:

Get the report info:

Reports - Get Reports - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Get the data source:

Datasets - Get Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Update data source:

Datasets - Update Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Change data source connection strings with PowerShell - Power BI | Microsoft Learn

Get the report info:

Reports - Update Report Content - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Please note that you need to have the necessary permissions to perform these actions. Also, make sure that the data source in the prod environment has the same schema and data as the one in the dev environment.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @LakshtSharma99 ,

It will only update the data source from DEV environment to PROD environment. You can use Power BI deployment pipelines to clone content from one stage in the deployment pipeline to another, typically from development to test, and from test to production. During deployment, Power BI copies the content from the current stage into the target one. The connections between the copied items are kept during the copy process. Power BI also applies the configured deployment rules to the updated content in the target stage.

You can also deploy content programmatically using the deployment pipelines REST APIs. You can learn more about this process in Automate your deployment pipeline using APIs and DevOps.

The Power BI deployment pipelines process - Power BI | Microsoft Learn

Best practices for deployment pipelines, the Power BI Application lifecycle management (ALM) tool - ...

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @LakshtSharma99 ,

To change the data source of a paginated report programmatically, you can use the Power BI REST API. Here are the high-level steps you can follow:

  1. Get the report ID of the paginated report you want to modify.
  2. Get the data source ID of the dataset you want to modify.
  3. Modify the connection string of the data source using the Power BI REST API.
  4. Update the data source of the dataset using the Power BI REST API.
  5. Update the report using the Power BI REST API.

Here are some references that can help you with the implementation:

Get the report info:

Reports - Get Reports - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Get the data source:

Datasets - Get Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Update data source:

Datasets - Update Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Change data source connection strings with PowerShell - Power BI | Microsoft Learn

Get the report info:

Reports - Update Report Content - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Please note that you need to have the necessary permissions to perform these actions. Also, make sure that the data source in the prod environment has the same schema and data as the one in the dev environment.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Will it also publish the report to PROD workspace? or just change the datasource in DEV workspace

Hi @LakshtSharma99 ,

It will only update the data source from DEV environment to PROD environment. You can use Power BI deployment pipelines to clone content from one stage in the deployment pipeline to another, typically from development to test, and from test to production. During deployment, Power BI copies the content from the current stage into the target one. The connections between the copied items are kept during the copy process. Power BI also applies the configured deployment rules to the updated content in the target stage.

You can also deploy content programmatically using the deployment pipelines REST APIs. You can learn more about this process in Automate your deployment pipeline using APIs and DevOps.

The Power BI deployment pipelines process - Power BI | Microsoft Learn

Best practices for deployment pipelines, the Power BI Application lifecycle management (ALM) tool - ...

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.