<?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: Problem with Power BI RLS in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Power-BI-RLS/m-p/355211#M10577</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/54517"&gt;@stas317&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you try using the code below to see if it works?&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;PRE&gt;// This is how you create embed token with effective identities
                    if (!string.IsNullOrEmpty(&lt;STRONG&gt;username&lt;/STRONG&gt;))//&lt;STRONG&gt;replace usename with your userId&lt;/STRONG&gt; 
                    {
                        var rls = new EffectiveIdentity(&lt;STRONG&gt;username&lt;/STRONG&gt;, new List&amp;lt;string&amp;gt; { report.DatasetId });
                        if (!string.IsNullOrWhiteSpace(roles))
                        {
                            var rolesList = new List&amp;lt;string&amp;gt;();
                            rolesList.AddRange(roles.Split(','));
                            rls.Roles = rolesList;
                        }
                        // Generate Embed Token with effective identities.
                        generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identities: new List&amp;lt;EffectiveIdentity&amp;gt; { rls });
                    }
                    else
                    {
                        // Generate Embed Token for reports without effective identities.
                        generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
                    }

                    var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 07:10:57 GMT</pubDate>
    <dc:creator>v-ljerr-msft</dc:creator>
    <dc:date>2018-02-09T07:10:57Z</dc:date>
    <item>
      <title>Problem with Power BI RLS</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Power-BI-RLS/m-p/354827#M10562</link>
      <description>&lt;P&gt;Hi all. I try to pass and use UserId (string) in token request parameter instead of the username. It's look like this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var generateTokenRequestParameters = new GenerateTokenRequest("View", null,&lt;BR /&gt;identities: new List&amp;lt;EffectiveIdentity&amp;gt; {&lt;BR /&gt;new EffectiveIdentity(&lt;BR /&gt;username: userId, roles: new List&amp;lt;string&amp;gt; {"role"}, datasets: new List&amp;lt;string&amp;gt; {datasets}&lt;BR /&gt;)});&lt;/PRE&gt;&lt;P&gt;And then I try to get token response by this parameters:&lt;/P&gt;&lt;PRE&gt;tokenResponse = await client.Reports.GenerateTokenInGroupAsync(groupId, reportId, generateTokenRequestParameters);&lt;/PRE&gt;&lt;P&gt;But&amp;nbsp;I immediately get an error: "&lt;SPAN&gt;Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'BadRequest'&lt;/SPAN&gt;"&lt;BR /&gt;Table filter DAX expression look like this:&amp;nbsp;[UserId] = USERNAME(). (UserId - string field)&lt;/P&gt;&lt;P&gt;What am I doing wrong and how can this problem be solved?&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:39:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Power-BI-RLS/m-p/354827#M10562</guid>
      <dc:creator>stas317</dc:creator>
      <dc:date>2018-02-08T16:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Power BI RLS</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Power-BI-RLS/m-p/355211#M10577</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/54517"&gt;@stas317&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you try using the code below to see if it works?&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;PRE&gt;// This is how you create embed token with effective identities
                    if (!string.IsNullOrEmpty(&lt;STRONG&gt;username&lt;/STRONG&gt;))//&lt;STRONG&gt;replace usename with your userId&lt;/STRONG&gt; 
                    {
                        var rls = new EffectiveIdentity(&lt;STRONG&gt;username&lt;/STRONG&gt;, new List&amp;lt;string&amp;gt; { report.DatasetId });
                        if (!string.IsNullOrWhiteSpace(roles))
                        {
                            var rolesList = new List&amp;lt;string&amp;gt;();
                            rolesList.AddRange(roles.Split(','));
                            rls.Roles = rolesList;
                        }
                        // Generate Embed Token with effective identities.
                        generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identities: new List&amp;lt;EffectiveIdentity&amp;gt; { rls });
                    }
                    else
                    {
                        // Generate Embed Token for reports without effective identities.
                        generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
                    }

                    var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 07:10:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Power-BI-RLS/m-p/355211#M10577</guid>
      <dc:creator>v-ljerr-msft</dc:creator>
      <dc:date>2018-02-09T07:10:57Z</dc:date>
    </item>
  </channel>
</rss>

