Hi everyone,

Back again with another productivity tip for Power BI.

The Situation

You are developing a PowerBI model using import mode, connecting to a development database the client provided. Then you published the model to PowerBI Service in order to review the solution, right? Ok, everything is fine and it's finally time to publish it to production.

But... you don't have access to production.

If the production DB is on-prem, and you have no access, how will you change your Power BI Desktop model to point to the final database?

To change the datasource connection string of your dataset you need to be able to refresh PowerBI Desktop directly to production... Or do you?

The Solution

When I started this post, I was about to explain how you could make use of Power BI parameters to define your data source and then take advantage of Power BI API operation Set parameters to change your connection string. While doing it, I was victim of Power BI's greatest strength: its quick updates.

What do I mean? Forget PowerShell, you can now change your parameters straight from the Power BI Service interface, which is PRETTY COOL.
Simply set up your parameter in Power BI Desktop, publish it to Power BI Service, and finally check the dataset settings. It should look something like the following:
Power BI dataset settings with disabled parameter

Humm ok, the field is actually disabled, perhaps we did something wrong? Don't worry, the solution is simple.

Go back to your Power BI Desktop and check the parameter type:
Power BI Desktop parameter setting

You see, for the editor to work properly, first you need to define its type, so go ahead and set it as text and republish your model to Power BI Service.

If you recheck the dataset properties, it should be already enabled. You may now change your connection string as you wish.
Power BI dataset settings with enabled parameter

No more full-refreshes of Power BI Desktop needed just in order to change a connection string. Easier days ahead!

Take care.