title: Update Credentials for Import mode Datasources in Power BI via API
body: <p>I am using the PowerBI API to upload some pbix files. Most of these files are using the Import mode for the SQL. </p>
  
  <p>When I use the rest API to upload the files, the credentials do not get updated on the website. I know the credentials do not live on the actual file. I also know there is API to patch these credentials using the API but I have not been able to make it work with the Import Mode. Only seems to work with <a href="https://community.powerbi.com/t5/Developer/Power-BI-API-Patch-Import-Azure-SQL-DB-Datasource-with-Windows/m-p/394487" rel="nofollow noreferrer">DirectQuery</a>. </p>
  
  <p>I have also tried <a href="https://msdn.microsoft.com/en-us/library/mt748181.aspx" rel="nofollow noreferrer">Set All connections</a> which is documented to only work with direct query connections using this format:</p>
  
  <pre><code>Data Source=xxxx.mydb.net; Initial Catalog=dbname;User ID=xxx;Password=xxxx;
  </code></pre>
  
  <p>My problem now is that the way Power BI manages cached credentials make it hard to figure out which credentials are being used. There is some magic happening where updating one file sometimes makes the other files which use the same credential also allow refresh. </p>
  
  <p>This is the error I am getting for all files uploaded via API.</p>
  
  <blockquote>
    <p>Data source errorScheduled refresh has been disabled due to at least one data source not having credentials provided. Please provide credentials for all data sources, and then turn scheduled refresh back on.</p>
    
    <p>Cluster This-is-not-relevant.net<br>
    Activity ID00000000-0000-0000-0000-000000000000<br>
    Request ID00000000-0000-0000-0000-000000000000<br>
    Time2020-09-99 99:54:11Z</p>
  </blockquote>
  
  <p>Thank you,<br>
  Chéyo</p>