<?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: RLS issue in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4271673#M58156</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/836802"&gt;@JinHe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Base on your description, it seems like you got stuck&amp;nbsp;when generating an embed token with RLS. Could you please check the following info?&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt; Ensure that the datasets and reports have been configured correctly for RLS. Verify that the dataset IDs and report IDs you are using in the code match the ones configured in Power BI service.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;Generate tokens for reports that do not require RLS separately&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN&gt;Create separate methods for generating tokens for reports with RLS&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;
&lt;P&gt;public GenerateTokenRequestV2 CreateTokenRequest(string datasetId, Guid reportId, Guid workspaceId, string rlsRole, string customerId, bool isRLSRequired)&lt;BR /&gt;{&lt;BR /&gt;List&amp;lt;EffectiveIdentity&amp;gt; identities = null;&lt;BR /&gt;&lt;BR /&gt;if (isRLSRequired)&lt;BR /&gt;{&lt;BR /&gt;var rlsIdentity = new EffectiveIdentity(&lt;BR /&gt;username: customerId.ToString(), // Customer Id&lt;BR /&gt;roles: new List&amp;lt;string&amp;gt; { rlsRole }, // Role name&lt;BR /&gt;datasets: new List&amp;lt;string&amp;gt; { datasetId }&lt;BR /&gt;);&lt;BR /&gt;identities = new List&amp;lt;EffectiveIdentity&amp;gt; { rlsIdentity };&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;var tokenRequest = new GenerateTokenRequestV2(&lt;BR /&gt;reports: new List&amp;lt;GenerateTokenRequestV2Report&amp;gt; { new GenerateTokenRequestV2Report(reportId.ToString()) },&lt;BR /&gt;datasets: new List&amp;lt;GenerateTokenRequestV2Dataset&amp;gt; { new GenerateTokenRequestV2Dataset(datasetId.ToString()) },&lt;BR /&gt;targetWorkspaces: workspaceId != Guid.Empty ? new List&amp;lt;GenerateTokenRequestV2TargetWorkspace&amp;gt; { new GenerateTokenRequestV2TargetWorkspace(workspaceId) } : null,&lt;BR /&gt;identities: identities&lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;return tokenRequest;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;var tokenRequest = CreateTokenRequest(datasetId, report.Id, workspaceId, "CustomerDynamic", customerId, isRLSRequired);&lt;BR /&gt;var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest);&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Wed, 06 Nov 2024 02:37:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-06T02:37:38Z</dc:date>
    <item>
      <title>RLS issue</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4269913#M58138</link>
      <description>&lt;P&gt;I follow this guide&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/cloud-rls#generate-an-embed-token" target="_self"&gt;Generate an embed token with RLS&lt;/A&gt;&amp;nbsp;to &lt;SPAN&gt;GetEmbedToken&amp;nbsp;&lt;/SPAN&gt;with RLS.&lt;/P&gt;&lt;P&gt;But I encountered a problem. This method reported 400 bad request when executing the following method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var rlsIdentity = new EffectiveIdentity(
                username: customerId.ToString(), // Customer Id
                roles: new List&amp;lt;string&amp;gt; { "CustomerDynamic" }, // Role name
                datasets: new List&amp;lt;string&amp;gt; { datasetId }
            );
            var tokenRequest = new GenerateTokenRequestV2(
                reports: new List&amp;lt;GenerateTokenRequestV2Report&amp;gt;() { new GenerateTokenRequestV2Report(report.Id) },
                datasets: new List&amp;lt;GenerateTokenRequestV2Dataset&amp;gt; { new GenerateTokenRequestV2Dataset(datasetId.ToString()) },
                targetWorkspaces: workspaceId != Guid.Empty ? new List&amp;lt;GenerateTokenRequestV2TargetWorkspace&amp;gt;() { new GenerateTokenRequestV2TargetWorkspace(workspaceId) } : null,
                identities: new List&amp;lt;EffectiveIdentity&amp;gt; { rlsIdentity }
            );
var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest);&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;We are developing PBI reports, and currently only one report is configured with RLS, while the other reports are not configured with RLS. Currently all reports that are not configured with RLS are not working. Obviously these reports cannot resolve RLS. How to deal with this situation, can the reports that are not configured with RLS ignore RLS instead of reporting errors?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 02:37:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4269913#M58138</guid>
      <dc:creator>JinHe</dc:creator>
      <dc:date>2024-11-05T02:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: RLS issue</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4271673#M58156</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/836802"&gt;@JinHe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Base on your description, it seems like you got stuck&amp;nbsp;when generating an embed token with RLS. Could you please check the following info?&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt; Ensure that the datasets and reports have been configured correctly for RLS. Verify that the dataset IDs and report IDs you are using in the code match the ones configured in Power BI service.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;Generate tokens for reports that do not require RLS separately&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN&gt;Create separate methods for generating tokens for reports with RLS&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;
&lt;P&gt;public GenerateTokenRequestV2 CreateTokenRequest(string datasetId, Guid reportId, Guid workspaceId, string rlsRole, string customerId, bool isRLSRequired)&lt;BR /&gt;{&lt;BR /&gt;List&amp;lt;EffectiveIdentity&amp;gt; identities = null;&lt;BR /&gt;&lt;BR /&gt;if (isRLSRequired)&lt;BR /&gt;{&lt;BR /&gt;var rlsIdentity = new EffectiveIdentity(&lt;BR /&gt;username: customerId.ToString(), // Customer Id&lt;BR /&gt;roles: new List&amp;lt;string&amp;gt; { rlsRole }, // Role name&lt;BR /&gt;datasets: new List&amp;lt;string&amp;gt; { datasetId }&lt;BR /&gt;);&lt;BR /&gt;identities = new List&amp;lt;EffectiveIdentity&amp;gt; { rlsIdentity };&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;var tokenRequest = new GenerateTokenRequestV2(&lt;BR /&gt;reports: new List&amp;lt;GenerateTokenRequestV2Report&amp;gt; { new GenerateTokenRequestV2Report(reportId.ToString()) },&lt;BR /&gt;datasets: new List&amp;lt;GenerateTokenRequestV2Dataset&amp;gt; { new GenerateTokenRequestV2Dataset(datasetId.ToString()) },&lt;BR /&gt;targetWorkspaces: workspaceId != Guid.Empty ? new List&amp;lt;GenerateTokenRequestV2TargetWorkspace&amp;gt; { new GenerateTokenRequestV2TargetWorkspace(workspaceId) } : null,&lt;BR /&gt;identities: identities&lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;return tokenRequest;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;var tokenRequest = CreateTokenRequest(datasetId, report.Id, workspaceId, "CustomerDynamic", customerId, isRLSRequired);&lt;BR /&gt;var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest);&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 02:37:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4271673#M58156</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-06T02:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: RLS issue</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4271709#M58157</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&lt;BR /&gt;Thanks for you reply.&amp;nbsp;This is how I solved this problem yesterday, in order to solve the token generation of all reports.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var tokenRequest = new GenerateTokenRequestV2(
    reports: new List&amp;lt;GenerateTokenRequestV2Report&amp;gt;() { new GenerateTokenRequestV2Report(report.Id) },
    datasets: new List&amp;lt;GenerateTokenRequestV2Dataset&amp;gt; { new GenerateTokenRequestV2Dataset(datasetId.ToString()) },
    targetWorkspaces: workspaceId != Guid.Empty ? new List&amp;lt;GenerateTokenRequestV2TargetWorkspace&amp;gt;() { new GenerateTokenRequestV2TargetWorkspace(workspaceId) } : null,
    identities: isPublic ? new List&amp;lt;EffectiveIdentity&amp;gt; { rlsIdentity } : null
);
var embedToken = await pbiClient.EmbedToken.GenerateTokenAsync(tokenRequest);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 03:00:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/RLS-issue/m-p/4271709#M58157</guid>
      <dc:creator>JinHe</dc:creator>
      <dc:date>2024-11-06T03:00:08Z</dc:date>
    </item>
  </channel>
</rss>

