Forum Discussion

John_L_Edwards's avatar
John_L_Edwards
Icon for Advocate III rankAdvocate III
2 years ago

Reverting from Prod back to Dev, when you have Data Source Rules

We are just getting our feet under us, and have figured out how to have Dev point to Dev sources, Prod point to Prod sources by using Deployment Rules in the Deployment Pipeline.  But when we tried to bring something back from Prod into Dev (which we'll likely use rarely) it appears that the Deployment Rule for Dataset source remains in place.  That is, the Dev version of the report points to Production data instead of Dev data.

 

Can someone who has done this provide me with the best practice for reverting a report/dataset group and having it point to the correct database sources in the Dev version?  Would be much obliged.

2 Replies

  • Hi John_L_Edwards,

     

    When you do a Backward Deployment i.e. moving an item from Prod back to Dev, Power BI copies the dataset file exactly as it exists in Production. Because Deployment Rules only apply forward (when deploying into a stage that has rules defined), the target Dev workspace doesn't have an incoming rule to intercept the file and rewrite the connection strings.

    As a result, your Dev dataset gets overwritten with your hardcoded Production connection strings.

     

    To go about this, you can -

     

    Parametrize Connections in Power Query (The Enterprise Standard)

    If you aren't already using Power Query parameters for your server and database names, implementing them eliminates this problem entirely.

     

    • In Power BI Desktop, create two text parameters: ServerName and DatabaseName.
    • Update your data source steps to look like: Sql.Database(#"ServerName", #"DatabaseName").
    • When you set up your Deployment Pipeline rules, use Parameter Rules instead of Data Source Rules.

    Let me know how this goes for you!

  • Hi John_L_Edwards 

    This behavior occurs because Power BI deployment pipelines apply deployment rules strictly as a one-way filter during forward deployments (Dev to Test to Prod), meaning the rule engine does not automatically intercept or rewrite data source connections when you execute a backward deployment (Prod to Dev). To revert your development dataset back to your dev data sources without breaking your pipeline links, the community-recommended best practice is to avoid manual desktop republishing and instead use a parameterized architecture coupled with manual workspace overriding. Go into Power BI Desktop, convert your hardcoded server and database strings into explicit Power Query Text Parameters (e.g., ServerName and DBName), and republish the model to establish a clean foundation. Now, whenever you must pull an asset backward from Prod to Dev, simply complete the deployment inside the pipeline, immediately navigate to the Semantic Model Settings directly within your Cloud Development Workspace, expand the Parameters section, manually type your development database server credentials into the parameter boxes, click Apply, and then re-authenticate your connection details under the Data source credentials section to instantly force the Dev environment back to dev data.