<?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: PowerBi Embedded API Works with RLS! in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/815156#M21057</link>
    <description>&lt;P&gt;Looks like you're putting the company id value inside the username field in the EffectiveIdentity in the embed token.&amp;nbsp; This must mean that the username value isn't used for actual authentication/authorization in your scenario.&amp;nbsp; I've found another reference to this ability here:&amp;nbsp;&amp;nbsp;&lt;A href="https://azure.microsoft.com/en-us/updates/power-bi-embedded-rls-ascii-characater-support/" target="_blank"&gt;https://azure.microsoft.com/en-us/updates/power-bi-embedded-rls-ascii-characater-support/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this username flexibility exclusive to the "Power BI Embedded" Azure resource?&amp;nbsp; I've tried to do the same thing with the Power BI Service (not Power BI Embdedded) and the REST API rejected my request.&amp;nbsp; I received a 401 Unauthorized response when trying to embed the report.&amp;nbsp; When I put my master user UPN back in the username field (of the EffectiveIdentity in the embed token) it started working again.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I'm wondering if there is a way to do the same thing (put an arbitrary value in the username field) without using Power BI Embedded.&amp;nbsp; CUSTOMDATA() doesn't work for me because I'm not using Azure Analysis Services.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any info or guidance.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 19:21:07 GMT</pubDate>
    <dc:creator>pbipbj</dc:creator>
    <dc:date>2019-10-10T19:21:07Z</dc:date>
    <item>
      <title>PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/231064#M7285</link>
      <description>&lt;P&gt;Hey everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of my frustrations with the new API is that it did not include RLS capabilities that were present in the old 1.x version. &amp;nbsp;I noticed that the API has been updated to 2.0.2 and is now working with RLS within powerBI models (only against reports currently).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-US/library/mt784614.aspx" target="_self"&gt;API Generate Embed Token&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedded-rls/" target="_self"&gt;Power BI Article Explaining RLS and Embedded in the New API&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before making the code change you first must create a role in your PowerBI report. &amp;nbsp;More than likely if you already have an embedded solution and found that RLS wasn't possible, you instead created a filter within the JavaScript and applied that to the report instead. &amp;nbsp;Whatever table you applied the filter in that scenario will probably be the table used in your role(s). &amp;nbsp;For me it was my Seller Table. &amp;nbsp;My report had a seller table (with CompanyId) that was related to a transaction table. &amp;nbsp;The goal is to only display transaction data applicable to the specific company viewing the report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 397px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/54669iB88D9A64C63BD5CA/image-dimensions/397x131?v=v2" width="397" height="131" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this I create a new role which I call "CompanyId" that will filter the seller table and in turn, the transaction table. &amp;nbsp;To create a new role:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Click on the Modeling tab&lt;/LI&gt;&lt;LI&gt;Select Manage Roles&lt;/LI&gt;&lt;LI&gt;Create a New Role (This will be the name of the role you pass in to the API)&lt;/LI&gt;&lt;LI&gt;Select the dimension table that contains the members that will filter your fact data&lt;/LI&gt;&lt;LI&gt;create the dax expression [YourColumnNametoFilter] = USERNAME(). &amp;nbsp;In my case, CompanyId&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 412px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/54670i70D016D6FAFD7F09/image-dimensions/412x219?v=v2" width="412" height="219" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;That's it for the report. &amp;nbsp;Unfortunately for me, it's impossible to test this because my username (or anyones username) doesn't equate to a companyID, It's something that is resolved in our web app and can be used at that point and passed into the API. &amp;nbsp;I suppose if you wanted to test you could hard code a value that exists in your dim table instead of USERNAME(). &amp;nbsp;Once I made this change I deployed the report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now that the report is ready I had to make 1 small change in the code to enable RLS functionality. &amp;nbsp;First, make sure you have updated your API library to 2.0.2. &amp;nbsp;The change happens where you create the parameter list to generate an embed token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The previous code:&lt;/P&gt;&lt;PRE&gt;// Generate Embed Token.
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");&lt;/PRE&gt;&lt;P&gt;The new Code:&lt;/P&gt;&lt;P&gt;If you remember, i created a role in my report called CompanyId and this is the literal value that I pass as the role name "CompanyId". &amp;nbsp;I also pass a value of the companyId and as an example here&amp;nbsp;"412125". &amp;nbsp;I also pass in the datasetId that I want to filter.&lt;/P&gt;&lt;PRE&gt;// Generate Embed Token.
var generateTokenRequestParameters = new GenerateTokenRequest(
     accessLevel: "view", 
     allowSaveAs: null, 
     identities: new List&amp;lt;EffectiveIdentity&amp;gt; { new EffectiveIdentity(username: "&lt;STRONG&gt;412125&lt;/STRONG&gt;", roles: new List&amp;lt;string&amp;gt; { "&lt;STRONG&gt;CompanyId&lt;/STRONG&gt;" }, 
     datasets: new List&amp;lt;string&amp;gt; { "&lt;STRONG&gt;DataSetId&lt;/STRONG&gt;" }) });&lt;/PRE&gt;&lt;P&gt;And the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running the code without RLS I get a table of the following values. &amp;nbsp;You can see company 412125 along with all other companies (Not Good!).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 123px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/54672iBFACB0DD0B20FCE9/image-dimensions/123x205?v=v2" width="123" height="205" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After creating the role and and passing in the companyId as the user&amp;nbsp;in the code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 148px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/54673i406D77A66AF6141E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:24:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/231064#M7285</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-14T18:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/231193#M7291</link>
      <description>&lt;P&gt;Thanks for your sharing. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 02:19:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/231193#M7291</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-08-15T02:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/231796#M7313</link>
      <description>&lt;P&gt;You're welcome. &amp;nbsp;It's good to see that this feature is now supported as it provides us the security we needed to our customer facing products.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kudos to the devs for making it happen so quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 17:32:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/231796#M7313</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-15T17:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/261826#M8069</link>
      <description>&lt;P&gt;Very awesome, you filled in some blanks I needed to make this work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They really need to update their documentation to include this exact information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 19:18:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/261826#M8069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-29T19:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/314703#M9316</link>
      <description>&lt;P&gt;What should i do if i want to pass different username with different role?below my code&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { new EffectiveIdentity(username: "username", roles: new List&amp;lt;string&amp;gt; { "Manager", "Manager1" }, datasets: new List&amp;lt;string&amp;gt; { "bd725bc3-09b4-4c21-84b4-727d84a3f131" }) });&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) For user name i want to add two emails id:&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) And different role for each email id.&lt;/P&gt;&lt;P&gt;when i pass username, it show result for both, Can you pls help???&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;&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, 30 Nov 2017 12:54:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/314703#M9316</guid>
      <dc:creator>mohittimpus</dc:creator>
      <dc:date>2017-11-30T12:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/314712#M9317</link>
      <description>&lt;P&gt;Below my code for AppownData for PowerBI Embedded-&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List&amp;lt;EffectiveIdentity&amp;gt; { new EffectiveIdentity(username: "username", roles: new List&amp;lt;string&amp;gt; { "Manager", "&lt;SPAN&gt;Manager1&lt;/SPAN&gt;" }, datasets: new List&amp;lt;string&amp;gt; { "bd725bc3-09b4-4c21-84b4-727d84a3f131" }) });&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i pass username for eg: my email &amp;amp; role as Manager then it show result for both Manager &amp;amp; Manager1.&lt;/P&gt;&lt;P&gt;but what i want it should show Manager role for one email, Manager1 for another email?&lt;/P&gt;&lt;P&gt;Its showing proper in Power Bi service but not when run this application.&lt;/P&gt;&lt;P&gt;Can you pls help???&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 13:07:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/314712#M9317</guid>
      <dc:creator>mohittimpus</dc:creator>
      <dc:date>2017-11-30T13:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/369782#M11030</link>
      <description>&lt;P&gt;How to use comanyid in place of username in this scenerio?????&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 12:51:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/369782#M11030</guid>
      <dc:creator>Anmolgan</dc:creator>
      <dc:date>2018-03-05T12:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/525647#M16193</link>
      <description>&lt;P&gt;invaluable example - thank you&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 21:40:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/525647#M16193</guid>
      <dc:creator>toy</dc:creator>
      <dc:date>2018-09-25T21:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/815156#M21057</link>
      <description>&lt;P&gt;Looks like you're putting the company id value inside the username field in the EffectiveIdentity in the embed token.&amp;nbsp; This must mean that the username value isn't used for actual authentication/authorization in your scenario.&amp;nbsp; I've found another reference to this ability here:&amp;nbsp;&amp;nbsp;&lt;A href="https://azure.microsoft.com/en-us/updates/power-bi-embedded-rls-ascii-characater-support/" target="_blank"&gt;https://azure.microsoft.com/en-us/updates/power-bi-embedded-rls-ascii-characater-support/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this username flexibility exclusive to the "Power BI Embedded" Azure resource?&amp;nbsp; I've tried to do the same thing with the Power BI Service (not Power BI Embdedded) and the REST API rejected my request.&amp;nbsp; I received a 401 Unauthorized response when trying to embed the report.&amp;nbsp; When I put my master user UPN back in the username field (of the EffectiveIdentity in the embed token) it started working again.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I'm wondering if there is a way to do the same thing (put an arbitrary value in the username field) without using Power BI Embedded.&amp;nbsp; CUSTOMDATA() doesn't work for me because I'm not using Azure Analysis Services.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any info or guidance.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 19:21:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/815156#M21057</guid>
      <dc:creator>pbipbj</dc:creator>
      <dc:date>2019-10-10T19:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/818649#M21109</link>
      <description>&lt;P&gt;FYI.&amp;nbsp; I was able to figure out my issue.&amp;nbsp; Previously, the report was shared with the master user account.&amp;nbsp; This situation required the EffectiveIdentity in the embed token to have the master user username.&amp;nbsp; We couldn't use it for dynamic RLS.&amp;nbsp; Then we moved the report to a workspace for which the master user is an admin.&amp;nbsp; After that, the username could be used for dynamic RLS (i.e., username could contain a value other than the master user username).&amp;nbsp; So that was the difference.&amp;nbsp; Shared reports couldn't use dynamic RLS.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 17:03:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/818649#M21109</guid>
      <dc:creator>pbipbj</dc:creator>
      <dc:date>2019-10-15T17:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/823924#M21167</link>
      <description>&lt;P&gt;We have had similar issues in the past using RLS within the REST API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are using the API in a "User Owns Data" model.&amp;nbsp; When we open the report we want that report to auto filter using the RLS identifier that we pass to the openinfg the report via the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would seem this is what you are saying you have achieved.&amp;nbsp;In my testing I am the only user account involved. Report is published to my Workspace - so I am an admin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you possibly paste in some code extracts within your API of your call to the report and how youy past the RLS name ? Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 21:59:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/823924#M21167</guid>
      <dc:creator>shaunwilks</dc:creator>
      <dc:date>2019-10-21T21:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/824982#M21176</link>
      <description>&lt;P&gt;This is the approach we used, which is taken from Microsoft's code in their embed tool (&lt;A href="https://app.powerbi.com/embedsetup/appownsdata" target="_blank"&gt;https://app.powerbi.com/embedsetup/appownsdata&lt;/A&gt;).&amp;nbsp; If you're in the User Owns Data scenario, there is an embed tool for that scenario too:&amp;nbsp;&amp;nbsp;&lt;A href="https://app.powerbi.com/embedsetup/userownsdata" target="_blank"&gt;https://app.powerbi.com/embedsetup/userownsdata&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The tool will send you a Visual Studio solution that demonstrates the use of their API.&lt;/P&gt;&lt;P&gt;If this still doesn't work for you, try publishing the report to a workspace other than "My Workspace" (one for which you're still an admin).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            try
            {
                using (var client = new PowerBIClient(new Uri(API_URL), tokenCredentials))
                {
                    PBI.Report report = await client.Reports.GetReportInGroupAsync(workspaceId, reportId);
                    if (report == null)
                    {
                        return null;
                    }

                    var datasets = await client.Datasets.GetDatasetByIdInGroupAsync(workspaceId, report.DatasetId);

                    GenerateTokenRequest generateTokenRequestParameters;

                    var username = await GetUsernameValue();
                    if (!string.IsNullOrWhiteSpace(username))
                    {
                        string roles = "RoleA,RoleB";
                        var rls = new EffectiveIdentity(username, new List { report.DatasetId });
                        if (!string.IsNullOrWhiteSpace(roles))
                        {
                            var rolesList = new List();
                            rolesList.AddRange(roles.Split(','));
                            rls.Roles = rolesList;
                        }
                        // Generate Embed Token with effective identities.
                        generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identities: new List { rls });
                    }
                    else
                    {
                        // Generate Embed Token for reports without effective identities.
                        generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
                    }

                    var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(workspaceId, report.Id, generateTokenRequestParameters);
                    if (tokenResponse == null)
                    {
                        return null;
                    }

                    return new EmbedConfig()
                    {
                        EmbedToken = tokenResponse,
                        EmbedUrl = report.EmbedUrl,
                        ReportId = report.Id
                    };
                }
            }
            catch (HttpOperationException ex)
            {
                return null;
            }

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 13:51:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/824982#M21176</guid>
      <dc:creator>pbipbj</dc:creator>
      <dc:date>2019-10-22T13:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/2994751#M40527</link>
      <description>&lt;P&gt;Hey all,&lt;BR /&gt;&lt;BR /&gt;Need some help with this.&lt;BR /&gt;&lt;BR /&gt;We have a pro licence, we have both Premium and a specific Embedded Capacity and have used the example shown to try and provide via our own portal reports to our suppliers. We have a pro account for the API call, which has admin access, all the tokens are coming back. We want to essentially say supplier A has logged onto the portal, they click on the report section, the API the uses the default user login, within the call it says Supplier ID = XXXX pull back just that supplier code/s and show this data to supplier A. If supplier B logs in they will only then see their associated code YYYY.&lt;BR /&gt;&lt;BR /&gt;I have created the role "supplier", in the DAX i have done:&amp;nbsp;&lt;SPAN&gt;[Supplier Id] = username()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;When our platform team tries the API call they get this error:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/848003i706DF3B38D74EEAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Is there something i or they are missing, thanks for your help in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 11:19:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/2994751#M40527</guid>
      <dc:creator>Shabyman2</dc:creator>
      <dc:date>2022-12-30T11:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi Embedded API Works with RLS!</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/2994761#M40528</link>
      <description>&lt;P&gt;Encase this useful:&lt;BR /&gt;&lt;SPAN&gt;Underlying Error: PowerBI service client received error HTTP response. HttpStatus: 503. PowerBIErrorCode: OpenConnectionError&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OpenConnectionError: Failed to open the MSOLAP connection.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 11:27:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBi-Embedded-API-Works-with-RLS/m-p/2994761#M40528</guid>
      <dc:creator>Shabyman2</dc:creator>
      <dc:date>2022-12-30T11:27:08Z</dc:date>
    </item>
  </channel>
</rss>

