Martin Schoombee walks us through changing data source credentials on deployment with Power BI:
The method we need to use here is the Patch method. Why is it Patch and not Post like we did with the parameters? Great question, and the “devil is in the details”…the method dictates how the underlying resource or attribute is modified, and the Patch method in this case means that there are partial (and in-place) modifications to an existing resource. Read more about the differences between Post, Put and Patch here.
This is one of those areas where Power BI can be quite a letdown if you only use the UI.