<?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: Change SSAS server name in data source of a pbix report programmatically in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/241515#M785</link>
    <description>&lt;P&gt;Any ideas or suggestions on this one yet?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Aug 2017 16:15:19 GMT</pubDate>
    <dc:creator>reggdsouza</dc:creator>
    <dc:date>2017-08-29T16:15:19Z</dc:date>
    <item>
      <title>Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/236300#M721</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using &lt;A href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ef14b07f-8802-4f35-9270-608ee37d8354/apis-for-pbix-in-ssrs-service?forum=sqlreportingservices#88dc8ba9-fe4f-4dc1-a5eb-6adc5ed22ac5" target="_self"&gt;this&lt;/A&gt;&amp;nbsp;solution, I was able to upload a pbix report on a reporting server without issues. I then tried updating the data source information by doing the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var dsInfo = rs.GetItemDataSources(report.Output + "/" + report.Name); //gets the data source of the report
var dsReference = (DataSourceDefinition) dsInfo[0].Item; //references the data source
dsReference.ConnectString = newConnectionString; //updates the connection string of the reference
dsReference.CredentialRetrieval = CredentialRetrievalEnum.Store; //sets credential retrieval value to store
dsReference.WindowsCredentials = true; //sets windowsCredential property to true
dsReference.UserName = username; //sets the user name through the report will be accessed
dsReference.Password = password; //sets the password through which the report will be accessed
DataSource df = new DataSource(); //creates a new datasource
df.Item = dsReference; //assigns the reference datasource to the new datasource
df.Name = dsInfo[0].Name; //assigns the reference datasource name to the new datasource name
rs.SetItemDataSources(report.Output + "/" + report.Name, new DataSource[] {df}); //replaces the datasource for the report
Console.WriteLine($"Report {report.Name} datasource updated...");&lt;/PRE&gt;&lt;P&gt;The above code works well when we access the report through the repoorting portal. However, when I open the report using the "Edit in Power BI Desktop", it throws an error saying the server name is incorrect. On clicking edit, it shows me a screen where I can update the SSAS server name. Once the server name is updated, the report works as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I do to update the server name value in the pbix file as well? It gets updated with the above code on the web portal(Report Works), but the server name remains unchanged on using Power BI Desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 16:01:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/236300#M721</guid>
      <dc:creator>reggdsouza</dc:creator>
      <dc:date>2017-08-22T16:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/236303#M723</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using &lt;A href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ef14b07f-8802-4f35-9270-608ee37d8354/apis-for-pbix-in-ssrs-service?forum=sqlreportingservices#88dc8ba9-fe4f-4dc1-a5eb-6adc5ed22ac5" target="_self"&gt;this&lt;/A&gt;&amp;nbsp;solution, I was able to upload a pbix report on a reporting server without issues. I then tried updating the data source information by doing the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var dsInfo = rs.GetItemDataSources(report.Output + "/" + report.Name); //gets the data source of the report
var dsReference = (DataSourceDefinition) dsInfo[0].Item; //references the data source
dsReference.ConnectString = newConnectionString; //updates the connection string of the reference
dsReference.CredentialRetrieval = CredentialRetrievalEnum.Store; //sets credential retrieval value to store
dsReference.WindowsCredentials = true; //sets windowsCredential property to true
dsReference.UserName = username; //sets the user name through the report will be accessed
dsReference.Password = password; //sets the password through which the report will be accessed
DataSource df = new DataSource(); //creates a new datasource
df.Item = dsReference; //assigns the reference datasource to the new datasource
df.Name = dsInfo[0].Name; //assigns the reference datasource name to the new datasource name
rs.SetItemDataSources(report.Output + "/" + report.Name, new DataSource[] {df}); //replaces the datasource for the report
Console.WriteLine($"Report {report.Name} datasource updated...");&lt;/PRE&gt;&lt;P&gt;The above code works well when we access the report through the repoorting portal. However, when I open the report using the "Edit in Power BI Desktop", it throws an error saying the server name is incorrect. On clicking edit, it shows me a screen where I can update the SSAS server name. Once the server name is updated, the report works as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I do to update the server name value in the pbix file as well? It gets updated with the above code on the web portal(Report Works), but the server name remains unchanged on using Power BI Desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 16:03:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/236303#M723</guid>
      <dc:creator>reggdsouza</dc:creator>
      <dc:date>2017-08-22T16:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/237515#M722</link>
      <description>&lt;P&gt;Any insights appreciated!!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 21:04:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/237515#M722</guid>
      <dc:creator>reggdsouza</dc:creator>
      <dc:date>2017-08-23T21:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/237922#M726</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39984" data-lia-user-login="reggdsouza" class="lia-mention lia-mention-user"&gt;reggdsouza&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Per my knowledge, it is not available to set/update data source in pbix file&amp;nbsp;&lt;SPAN&gt;programmatically. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I will consult with&amp;nbsp;someone else more familiar with this, once I get any response, I will give you an update.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;BR /&gt;Yuliana Gu&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 08:45:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/237922#M726</guid>
      <dc:creator>v-yulgu-msft</dc:creator>
      <dc:date>2017-08-24T08:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/238954#M736</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39984" data-lia-user-login="reggdsouza" class="lia-mention lia-mention-user"&gt;reggdsouza&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since PBIX file is not a straight forward xml file like SSRS rdl report, it is not possible to update the data source in pbix file programmatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Yuliana Gu&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2017 08:15:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/238954#M736</guid>
      <dc:creator>v-yulgu-msft</dc:creator>
      <dc:date>2017-08-25T08:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/239292#M742</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="14525" data-lia-user-login="v-yulgu-msft" class="lia-mention lia-mention-user"&gt;v-yulgu-msft&lt;/a&gt;. Appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any&amp;nbsp;recommendation for uploading reports from and to different environments.&amp;nbsp;&amp;nbsp; E.g. dev to test to prod? &amp;nbsp;We have few&amp;nbsp;pbix reports which is updated every week in the dev environment and need to be uploaded to the production environment. Production environment have different custom reports too that do not exist in test. So we cannot replace the whole reporting database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We would like to find a way to automate this process of moving reports from one environment to another. Any suggestions highly appreciated. Thanks!!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2017 16:07:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/239292#M742</guid>
      <dc:creator>reggdsouza</dc:creator>
      <dc:date>2017-08-25T16:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/241515#M785</link>
      <description>&lt;P&gt;Any ideas or suggestions on this one yet?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 16:15:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/241515#M785</guid>
      <dc:creator>reggdsouza</dc:creator>
      <dc:date>2017-08-29T16:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change SSAS server name in data source of a pbix report programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/241742#M800</link>
      <description>&lt;P&gt;Please vote for this &lt;A href="https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/31046011-automated-report-deployment-for-power-bi-report-se" target="_self"&gt;idea&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 02:49:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Change-SSAS-server-name-in-data-source-of-a-pbix-report/m-p/241742#M800</guid>
      <dc:creator>xpherion</dc:creator>
      <dc:date>2017-08-30T02:49:20Z</dc:date>
    </item>
  </channel>
</rss>

