Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
twalsh0625
Advocate I
Advocate I

Pass UID from App to Embeded report

Is it possible, with embedded report, to filter content automatically based on the UID logged ito the app which the report is embedded? 

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@twalsh0625 wrote:

Is it possible, with embedded report, to filter content automatically based on the UID logged ito the app which the report is embedded? 


@twalsh0625

Yes.

If the UID you mean is a Power BI Account, you can use Embedding with Power BI users and set Power BI Row Level Security.

 

If the UID you mean is the userID in your own app, you'll have to use Embedding with non-Power BI users. As to filter or using RLS, RLS used to work for the old embedding model(deprecated), for the new model, the RLS feature is on the roadmap and would be released in next quarter. So at this moment, use filter in the Power BI Javascript API can be the only workaround. See a demo below.

 

 

<html>

 <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>

<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
 
<script type="text/javascript">
window.onload = function () { 
 

var uid= ["uid1"]; //get the uid with javascript from your page

 var  Filter = {
   $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Table",
    column: "UID"
  },  
      operator: "Contains",
      values: uid
     
	 
} 
    // Read embed application token from Model
    var accessToken = "H4sIAAAAAAAEAB2 xxxxx     uCwAA";

    // Read embed URL from Model
    var embedUrl = "https://app.powerbi.com/reportEmbed?reportId=1f1d9145-738a-4d20-ab5b-1236b283e942&groupId=73e1a3c6-08c4-4651-aa04-2bb701a573c7";

    // Read report Id from Model
    var embedReportId = "1f1d9145-738a-4d20-ab5b-1236b283e942";

    // Get models. models contains enums that can be used.
    var models = window['powerbi-client'].models;

    // Embed configuration used to describe the what and how to embed.
    // This object is used when calling powerbi.embed.
    // This also includes settings and options such as filters.
    // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
    var embedConfiguration = {
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: accessToken,
        embedUrl: embedUrl,
        id: embedReportId,
        permissions: models.Permissions.All,
		filters:[Filter,Filter2],
        settings: {
            filterPaneEnabled: true,
            navContentPaneEnabled: true
        }
    };
  
var $reportContainer = $('#reportContainer');
 
var report = powerbi.embed($reportContainer.get(0), embedConfiguration); 
 
}
</script>

<div id="reportContainer" powerbi-settings-nav-content-pane-enabled="true"   powerbi-settings-filter-pane-enabled="true"></div>

</html>

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.