title: How to automate publishing of Power BI (PBIX) from desktop to Power BI Web with config for environment
body: <ol>
  <li>I currently have a desktop PBIX file that I manually publish to Power BI Web. </li>
  <li>I have to keep different version of the same PBIX file just to keep track of different sources based on environment such as Dev/QA/UAT/Prod etc</li>
  <li>I have more than one data source for each environment i.e. in same PBIX file I have data coming from say Application Insights and REST API.</li>
  </ol>
  
  <p>I scanned through power bi community to see how to do this but can't find relevant information. All pointers are for refreshing either the local PBIX or using Schedule Refresh option in Power BI Web. </p>
  
  <p>Someone even wrote code to hit Publish code via OLE automation but that's not acceptable solution.</p>
  
  <p><a href="https://community.powerbi.com" rel="nofollow noreferrer">https://community.powerbi.com</a></p>
  
  <p>I would like to automate this process such that</p>
  
  <p>A. I can provide the data source connection string/ credentials externally based on the environment I want to publish it to.</p>
  
  <p>B. Publish the report to Power BI web using a service account instead of my own.</p>
  
  <p>Our current build and deployment tool set does allow use of PowerShell/ Azure CLI etc. Hence it would be helpful if the solution uses those.</p>