<?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 Specifying EffectiveIdentity when Retrieving a PowerBI Embedded Report Creation Token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Specifying-EffectiveIdentity-when-Retrieving-a-PowerBI-Embedded/m-p/285932#M8441</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I work for a SaaS company with multiple customer tenants.&amp;nbsp; Each customer has access to their own data but should never see other customer's data.&amp;nbsp; &amp;nbsp;In order to achieve this, I pass the customer's tenant id as the username when retrieving tokens.&amp;nbsp; That tenant id is then used to filter the report data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to work well when embedding existing reports but we also want to allow customers to create their own reports via the embedded interface.&amp;nbsp; However, when I specify the EffectiveIdentity and attempt to retrieve a creation token, I get a "Forbidden" error that states that EffectiveIdentities are not allowed for report creation tokens.&amp;nbsp; Without being able to specify the EffectiveIdentity, I'm unable to filter the data and report creators essentially end up having access to data from all tenants.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another way to specify identities for report creation tokens?&amp;nbsp; Please see my current code below (notice how I commented out effective identities when creating the generateTokenParameters).&amp;nbsp; The hardcoded "24" below is the customer tenant id which I'm unable to specify without an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                    string roles = "Default";

                    var rls = new EffectiveIdentity("24", new List&amp;lt;string&amp;gt; { this.AppConfig.PowerBI_DataSetId });
                    if (!string.IsNullOrWhiteSpace(roles))
                    {
                        var rolesList = new List&amp;lt;string&amp;gt;();
                        rolesList.AddRange(roles.Split(','));
                        rls.Roles = rolesList;
                    }
                    
                    GenerateTokenRequest generateTokenRequestParameters;
                    generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: TokenAccessLevel.Create, datasetId: this.AppConfig.PowerBI_DataSetId, allowSaveAs:true);//, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { rls });
                    
                    var tokenResponse = await client.Reports.GenerateTokenForCreateInGroupAsync(this.UserSession.CurrentUser.Organization.PowerBIWorkspaceId, generateTokenRequestParameters);
                    
                    // Generate Embed Configuration.
                    model.EmbedConfig.EmbedToken = tokenResponse;
                    model.EmbedConfig.DatasetId = this.AppConfig.PowerBI_DataSetId;
                    model.EmbedConfig.EmbedUrl = string.Format("https://app.powerbi.com//reportEmbed?groupId={0}", this.UserSession.CurrentUser.Organization.PowerBIWorkspaceId);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 21 Oct 2017 22:39:21 GMT</pubDate>
    <dc:creator>Elderin</dc:creator>
    <dc:date>2017-10-21T22:39:21Z</dc:date>
    <item>
      <title>Specifying EffectiveIdentity when Retrieving a PowerBI Embedded Report Creation Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Specifying-EffectiveIdentity-when-Retrieving-a-PowerBI-Embedded/m-p/285932#M8441</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I work for a SaaS company with multiple customer tenants.&amp;nbsp; Each customer has access to their own data but should never see other customer's data.&amp;nbsp; &amp;nbsp;In order to achieve this, I pass the customer's tenant id as the username when retrieving tokens.&amp;nbsp; That tenant id is then used to filter the report data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to work well when embedding existing reports but we also want to allow customers to create their own reports via the embedded interface.&amp;nbsp; However, when I specify the EffectiveIdentity and attempt to retrieve a creation token, I get a "Forbidden" error that states that EffectiveIdentities are not allowed for report creation tokens.&amp;nbsp; Without being able to specify the EffectiveIdentity, I'm unable to filter the data and report creators essentially end up having access to data from all tenants.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another way to specify identities for report creation tokens?&amp;nbsp; Please see my current code below (notice how I commented out effective identities when creating the generateTokenParameters).&amp;nbsp; The hardcoded "24" below is the customer tenant id which I'm unable to specify without an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                    string roles = "Default";

                    var rls = new EffectiveIdentity("24", new List&amp;lt;string&amp;gt; { this.AppConfig.PowerBI_DataSetId });
                    if (!string.IsNullOrWhiteSpace(roles))
                    {
                        var rolesList = new List&amp;lt;string&amp;gt;();
                        rolesList.AddRange(roles.Split(','));
                        rls.Roles = rolesList;
                    }
                    
                    GenerateTokenRequest generateTokenRequestParameters;
                    generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: TokenAccessLevel.Create, datasetId: this.AppConfig.PowerBI_DataSetId, allowSaveAs:true);//, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { rls });
                    
                    var tokenResponse = await client.Reports.GenerateTokenForCreateInGroupAsync(this.UserSession.CurrentUser.Organization.PowerBIWorkspaceId, generateTokenRequestParameters);
                    
                    // Generate Embed Configuration.
                    model.EmbedConfig.EmbedToken = tokenResponse;
                    model.EmbedConfig.DatasetId = this.AppConfig.PowerBI_DataSetId;
                    model.EmbedConfig.EmbedUrl = string.Format("https://app.powerbi.com//reportEmbed?groupId={0}", this.UserSession.CurrentUser.Organization.PowerBIWorkspaceId);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2017 22:39:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Specifying-EffectiveIdentity-when-Retrieving-a-PowerBI-Embedded/m-p/285932#M8441</guid>
      <dc:creator>Elderin</dc:creator>
      <dc:date>2017-10-21T22:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying EffectiveIdentity when Retrieving a PowerBI Embedded Report Creation Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Specifying-EffectiveIdentity-when-Retrieving-a-PowerBI-Embedded/m-p/287690#M8448</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/31627"&gt;@Elderin&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I work for a SaaS company with multiple customer tenants.&amp;nbsp; Each customer has access to their own data but should never see other customer's data.&amp;nbsp; &amp;nbsp;In order to achieve this, I pass the customer's tenant id as the username when retrieving tokens.&amp;nbsp; That tenant id is then used to filter the report data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This seems to work well when embedding existing reports but we also want to allow customers to create their own reports via the embedded interface.&amp;nbsp; However, when I specify the EffectiveIdentity and attempt to retrieve a creation token, I get a "Forbidden" error that states that EffectiveIdentities are not allowed for report creation tokens.&amp;nbsp; Without being able to specify the EffectiveIdentity, I'm unable to filter the data and report creators essentially end up having access to data from all tenants.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there another way to specify identities for report creation tokens?&amp;nbsp; Please see my current code below (notice how I commented out effective identities when creating the generateTokenParameters).&amp;nbsp; The hardcoded "24" below is the customer tenant id which I'm unable to specify without an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                    string roles = "Default";

                    var rls = new EffectiveIdentity("24", new List&amp;lt;string&amp;gt; { this.AppConfig.PowerBI_DataSetId });
                    if (!string.IsNullOrWhiteSpace(roles))
                    {
                        var rolesList = new List&amp;lt;string&amp;gt;();
                        rolesList.AddRange(roles.Split(','));
                        rls.Roles = rolesList;
                    }
                    
                    GenerateTokenRequest generateTokenRequestParameters;
                    generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: TokenAccessLevel.Create, datasetId: this.AppConfig.PowerBI_DataSetId, allowSaveAs:true);//, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { rls });
                    
                    var tokenResponse = await client.Reports.GenerateTokenForCreateInGroupAsync(this.UserSession.CurrentUser.Organization.PowerBIWorkspaceId, generateTokenRequestParameters);
                    
                    // Generate Embed Configuration.
                    model.EmbedConfig.EmbedToken = tokenResponse;
                    model.EmbedConfig.DatasetId = this.AppConfig.PowerBI_DataSetId;
                    model.EmbedConfig.EmbedUrl = string.Format("https://app.powerbi.com//reportEmbed?groupId={0}", this.UserSession.CurrentUser.Organization.PowerBIWorkspaceId);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/31627"&gt;@Elderin&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Based on my test, when creating an embedded token for reports creation specifying the attribute&amp;nbsp;identities in the JSON body, it returns error message "Creating embed token for accessing dataset 05dxxxxx9090a4c shouldn't have effective identity". So I think it is not supported at this moment. You can submit your idea at &lt;A href="http://ideas.powerbi.com" target="_self"&gt;Power BI Ideas&lt;/A&gt; and vote it up.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 08:56:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Specifying-EffectiveIdentity-when-Retrieving-a-PowerBI-Embedded/m-p/287690#M8448</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-11-06T08:56:44Z</dc:date>
    </item>
  </channel>
</rss>

