<?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: Update DataSet Credentials using Service Principal in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2249505#M33575</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/325592"&gt;@akarkal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Whether your problem has been resolved? If yes, could you please mark the helpful post as&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Answered&lt;/STRONG&gt;&lt;SPAN&gt;? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Dec 2021 09:29:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-12-21T09:29:06Z</dc:date>
    <item>
      <title>Update DataSet Credentials using Service Principal</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2236065#M33425</link>
      <description>&lt;P&gt;- I have a dataset that is setup to load data from Azure Storage&lt;/P&gt;&lt;P&gt;- I recently switched to using Service Principal.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- I am trying the below code after taking ownership of the dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- tenant settings has the toggle enabled for service principal to access admin apis&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- service principal is the admin of the workspace (groupId) used below&lt;/P&gt;&lt;P&gt;- There are &lt;U&gt;&lt;STRONG&gt;no gateways&lt;/STRONG&gt; &lt;EM&gt;&lt;STRONG&gt;configured as all the data is in azure&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;- However when I use access the dataset using C# nuget package, the gatewayId on datasource is populated.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;var&lt;/SPAN&gt; datasources = powerbiClient.Datasets&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;.GetDatasourcesInGroup(groupId, dataSetId.ToString()).First();&lt;BR /&gt;Assert.NotNull(datasource.GatewayId.Value)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the only way I found to update a datasource was&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="s1"&gt;var&lt;/SPAN&gt; credentials = &lt;SPAN class="s1"&gt;new&lt;/SPAN&gt; CredentialDetails(&lt;BR /&gt;&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;@"{&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;credentialData&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;:[{&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;name&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;:&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;accessToken&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;, &lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;value&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;:&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;"&lt;SPAN class="s2"&gt; + accessToken + &lt;/SPAN&gt;@"&lt;SPAN class="s3"&gt;""&lt;/SPAN&gt;}]}"&lt;SPAN class="s2"&gt;,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;CredentialType.Anonymous,&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;EncryptedConnection.NotEncrypted,&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;EncryptionAlgorithm.None,&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;PrivacyLevel.None&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;powerbiClient.Gateways&lt;BR /&gt;        .UpdateDatasource(datasource.GatewayId.Value, dataSetId, &lt;SPAN class="s1"&gt;new&lt;/SPAN&gt; UpdateDatasourceRequest(credentials));&lt;/PRE&gt;&lt;P&gt;However I get error that the action is unauthorized.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't see any gateways in app.powerbi.com (not as admin) and I get empty result when I get all gateways&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I update credentials of data set that the Service Principal is the owner of?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 16:09:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2236065#M33425</guid>
      <dc:creator>akarkal</dc:creator>
      <dc:date>2021-12-13T16:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Update DataSet Credentials using Service Principal</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2241988#M33481</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/325592"&gt;@akarkal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;First, please review the following links to check if you have missed any necessary step.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nickyvv.com/2020/06/refresh-a-power-bi-dataset-with-powershell-and-a-service-principal.html" target="_self"&gt;&lt;STRONG&gt;Refresh a Power BI Dataset with PowerShell and a Service Principal&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/PowerBiDevCamp/TenantManagement" target="_self"&gt;&lt;STRONG&gt;The Tenant Management Application for Power BI&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Just for example,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/service-admin-portal#allow-service-principals-to-use-power-bi-apis" target="_self"&gt;&lt;EM&gt;Allow service principals to use Power BI APIs&lt;/EM&gt;&lt;/A&gt;&lt;/STRONG&gt; in &lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/service-admin-portal" target="_self"&gt;Admin Portal&lt;/A&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Allow service principals to use Power BI APIs" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/644864iFD2D0B031AC80054/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_0-1639642201762.png" alt="Allow service principals to use Power BI APIs" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Allow service principals to use Power BI APIs&lt;/span&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal#step-4---add-the-service-principal-to-your-workspace" target="_self"&gt;&lt;EM&gt;&lt;STRONG&gt;Add the Service Principal as an Admin to the workspace&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Add the Service Principal as an Admin to the workspace" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/644872i22A0587475537E2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_1-1639642374234.png" alt="Add the Service Principal as an Admin to the workspace" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Add the Service Principal as an Admin to the workspace&lt;/span&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Then verify if you are experiencing a problem similar to the one in the posts below. If so, you can refer to the solution to solve your problem.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/67309793/how-to-update-azure-sql-datasource-credentials-of-powerbi-dataset-programmatical" target="_self"&gt;&lt;STRONG&gt;How to update Azure SQL datasource credentials of PowerBI dataset programmatically?&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_2-1639642729524.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/644879iE279CB698344AE3F/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_2-1639642729524.png" alt="yingyinr_2-1639642729524.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 08:21:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2241988#M33481</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-16T08:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Update DataSet Credentials using Service Principal</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2249505#M33575</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/325592"&gt;@akarkal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Whether your problem has been resolved? If yes, could you please mark the helpful post as&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Answered&lt;/STRONG&gt;&lt;SPAN&gt;? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 09:29:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Update-DataSet-Credentials-using-Service-Principal/m-p/2249505#M33575</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-21T09:29:06Z</dc:date>
    </item>
  </channel>
</rss>

