<?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 unable to generate token using the datasetid for reports using effective identity in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/unable-to-generate-token-using-the-datasetid-for-reports-using/m-p/783627#M20629</link>
    <description>&lt;P&gt;using (var client = new PowerBIClient(new Uri(API_URL), new TokenCredentials(accessToken, "Bearer")))&lt;BR /&gt;{&lt;BR /&gt;Report powerBiReport = await client.Reports.GetReportInGroupAsync(groupId, reportId.ToString());&lt;BR /&gt;#region default&lt;BR /&gt;var generateTokenRequestParameters = new GenerateTokenRequest("view", null, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { new EffectiveIdentity(username: username, roles: roles, datasets: new List&amp;lt;string&amp;gt; { powerBiReport.DatasetId }) });&lt;BR /&gt;var token = await client.Reports.GenerateTokenInGroupAsync(groupId, reportId, generateTokenRequestParameters);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works fine without effectiveidentity ut it fails with effective identity. Please help in identifying the parameters&lt;/P&gt;</description>
    <pubDate>Wed, 04 Sep 2019 13:54:30 GMT</pubDate>
    <dc:creator>Sanjana</dc:creator>
    <dc:date>2019-09-04T13:54:30Z</dc:date>
    <item>
      <title>unable to generate token using the datasetid for reports using effective identity</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/unable-to-generate-token-using-the-datasetid-for-reports-using/m-p/783627#M20629</link>
      <description>&lt;P&gt;using (var client = new PowerBIClient(new Uri(API_URL), new TokenCredentials(accessToken, "Bearer")))&lt;BR /&gt;{&lt;BR /&gt;Report powerBiReport = await client.Reports.GetReportInGroupAsync(groupId, reportId.ToString());&lt;BR /&gt;#region default&lt;BR /&gt;var generateTokenRequestParameters = new GenerateTokenRequest("view", null, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { new EffectiveIdentity(username: username, roles: roles, datasets: new List&amp;lt;string&amp;gt; { powerBiReport.DatasetId }) });&lt;BR /&gt;var token = await client.Reports.GenerateTokenInGroupAsync(groupId, reportId, generateTokenRequestParameters);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works fine without effectiveidentity ut it fails with effective identity. Please help in identifying the parameters&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 13:54:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/unable-to-generate-token-using-the-datasetid-for-reports-using/m-p/783627#M20629</guid>
      <dc:creator>Sanjana</dc:creator>
      <dc:date>2019-09-04T13:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: unable to generate token using the datasetid for reports using effective identity</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/unable-to-generate-token-using-the-datasetid-for-reports-using/m-p/784201#M20643</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/167931"&gt;@Sanjana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you mean by fails , do you get any error ? pls share that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Make sure that &lt;STRONG&gt;username&lt;/STRONG&gt; &lt;STRONG&gt;,roles&lt;/STRONG&gt; are not having null values&lt;/LI&gt;&lt;LI&gt;Make sure your reports developed using the RLS&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;                    if (datasets.IsEffectiveIdentityRolesRequired == true)
                    {
                        if (!string.IsNullOrWhiteSpace(username))
                        {
                            var rls = new EffectiveIdentity { Username = username, Roles = new List&amp;lt;string&amp;gt; { roles }, Datasets = 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 });
                        }
                       
                    }&lt;/PRE&gt;&lt;P&gt;Try the above code which having more condition for you to check&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 05:28:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/unable-to-generate-token-using-the-datasetid-for-reports-using/m-p/784201#M20643</guid>
      <dc:creator>Jayendran</dc:creator>
      <dc:date>2019-09-05T05:28:11Z</dc:date>
    </item>
  </channel>
</rss>

