Forum Discussion

Amik_singh's avatar
Amik_singh
Advocate I
8 months ago
Solved

Database with change in pipeline

we use Deployment Pipelines (Dev , Test , Prod). Every time I deploy from Dev to Test, the data source resets to the 'Dev' database, and I have to manually update the credentials and server names in ...
  • Amar_Kumar's avatar
    8 months ago

    Hello Amik_singh The Solution is Deployment Rules

    Service has a built-in feature Deployment Rules that acts as a "find and replace" during the deployment process.
    ​Step 1: Parameterize your Desktop Report
    ​Before publishing, ensure your Server and Database names are Parameters in Power Query: ​In Power BI Desktop, go to Transform Data > Manage Parameters.
    ​Create a parameter called pServerName.
    ​Use this parameter in your Source step: Sql.Database(pServerName, "MyDatabase").
    ​Step 2: Configure the Rule in the Service
    ​Go to your Deployment Pipeline in the Power BI Service.
    ​Click on the Deployment Rules icon (the lightning bolt) between the stages (e.g., between Dev and Test).
    ​Select the Semantic Model you are deploying.
    ​Go to the Parameters tab.
    ​Set a rule: When deploying to Test, change pServerName to test-sql-server.database.windows.net.
    ​Step 3: Set and Forget
    ​Now, every time you click "Deploy," Power BI will automatically swap the Dev values for Test values. Your production data remains secure and untouched, and you never have to manually edit connection strings again.

     

    please marke it a solution if it helps.