<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: UpdateDatasourcesInGroup on a v3 datasource / dataset does not work -- need to change connection in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1466100#M26298</link>
    <description>&lt;P&gt;Hi, we are also facing the same issue. Has anyone found any solution?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 30 Oct 2020 14:05:08 GMT</pubDate>
    <dc:creator>dmarkham</dc:creator>
    <dc:date>2020-10-30T14:05:08Z</dc:date>
    <item>
      <title>UpdateDatasourcesInGroup on a v3 datasource / dataset does not work -- need to change connection str</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1088229#M23656</link>
      <description>&lt;P&gt;Hi all -- I have a need to change the server, database, username, and password for Datasets on a Power BI workspace with attached premium capacity, using Azure Power BI Embedded.&amp;nbsp; All data sources are Azure PaaS SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Historically, I have used&amp;nbsp;SetAllDatasetConnectionsInGroup to change the server and database, and then used&amp;nbsp;UpdateDatasource to change the username and password.&amp;nbsp; This has worked great -- but I knew that&amp;nbsp;SetAllDatasetConnectionsInGroup&amp;nbsp; was depreciated and it would eventually break -- and that day has come.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It no longer works with newer Power BI files that have the "v3" data sources enabeld, called "enhanced metadata) in Power BI Desktop (see &amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-enhanced-dataset-metadata" target="_self"&gt;https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-enhanced-dataset-metadata&lt;/A&gt;&amp;nbsp;).&amp;nbsp; The&amp;nbsp;SetAllDatasetConnectionsInGroup&amp;nbsp; now returns the error&amp;nbsp;PowerBIUpdateMetadataUnsupportedModelWithV3DataSourceException.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To try to fix this, I moved to using the&amp;nbsp;UpdateDatasourcesInGroup, but this doesn't seem to work.&amp;nbsp; It changes the server and database as shown in the Power BI portal, but when I access the report, it shows an error, and that error contains the OLD servername and database.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So -- what is the proper way to change the server and database on a v3 datasource usign the REST API when the datasource is conencted via DirectQuery to Azure PaaS SQL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW -- I tried many workarounds, including using parameters for servername/database (result: parameters not permitted on the PowerBI service for DirectQuery SQL), editing the PBIX file before uploading (not possible as connection string is embedded in compressed data in the PBIX for v3 data sources), using a PBIT (not allowed in REST upload), etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help -- and thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 16:14:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1088229#M23656</guid>
      <dc:creator>caiken</dc:creator>
      <dc:date>2020-05-13T16:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateDatasourcesInGroup on a v3 datasource / dataset does not work -- need to change connection</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1107328#M23822</link>
      <description>&lt;P&gt;Anyone?&amp;nbsp; Certainly someone is trying to change connection strings on the fly and experiencing trouble like I am?&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 21:15:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1107328#M23822</guid>
      <dc:creator>caiken</dc:creator>
      <dc:date>2020-05-22T21:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateDatasourcesInGroup on a v3 datasource / dataset does not work -- need to change connection</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1338129#M25512</link>
      <description>&lt;P&gt;HI &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/230455"&gt;@caiken&lt;/a&gt; ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you find a solution ? I am facing same issue now. Please share you approach. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 09:25:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1338129#M25512</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-01T09:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateDatasourcesInGroup on a v3 datasource / dataset does not work -- need to change connection</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1466100#M26298</link>
      <description>&lt;P&gt;Hi, we are also facing the same issue. Has anyone found any solution?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 14:05:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1466100#M26298</guid>
      <dc:creator>dmarkham</dc:creator>
      <dc:date>2020-10-30T14:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateDatasourcesInGroup on a v3 datasource / dataset does not work -- need to change connection</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1466471#M26304</link>
      <description>&lt;P&gt;This works for me...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void UpdateSqlDatabaseConnectionString(Guid WorkspaceId, string DatasetId, 
                                                     string Server, string Database) {

  var pbiClient = TokenManager.GetPowerBiClient(requiredScopes);

  Datasource targetDatasource = 
             pbiClient.Datasets.GetDatasourcesInGroup(WorkspaceId, DatasetId).Value.First();

  string currentServer = targetDatasource.ConnectionDetails.Server;
  string currentDatabase = targetDatasource.ConnectionDetails.Database;

  if (Server.ToLower().Equals(currentServer.ToLower()) &amp;amp;&amp;amp; 
      Database.ToLower().Equals(currentDatabase.ToLower())) {
    Console.WriteLine("New server and database name are the same as the old names");
    return;
  }

  DatasourceConnectionDetails connectionDetails = new DatasourceConnectionDetails {
    Database = Database,
    Server = Server
  };

  UpdateDatasourceConnectionRequest updateConnRequest =
    new UpdateDatasourceConnectionRequest {
      DatasourceSelector = targetDatasource,
      ConnectionDetails = connectionDetails
    };

  UpdateDatasourcesRequest updateDatasourcesRequest = 
                           new UpdateDatasourcesRequest(updateConnRequest);
  
  pbiClient.Datasets.UpdateDatasourcesInGroup(WorkspaceId, DatasetId, updateDatasourcesRequest);

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 18:25:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/UpdateDatasourcesInGroup-on-a-v3-datasource-dataset-does-not/m-p/1466471#M26304</guid>
      <dc:creator>TedPattison</dc:creator>
      <dc:date>2020-10-30T18:25:01Z</dc:date>
    </item>
  </channel>
</rss>

