Forum Discussion

PhilSteel's avatar
PhilSteel
New Member
4 years ago
Solved

OData passing Data from Embed

Hi

I'm getting started with integrating with Power BI Embedded.

 

Our Application has an ODATA (Also a Rest Endpoint) endpoint which returns data based on a users permissions both row based and column based permission using extensive logic based on Roles, Features Enabled, Data Access Rules etc which cannot be fulfilled by RLS in Analysis Services so we need to use this.

 

The OData endpoint uses a Bearer token for Authentication which is generated by our application.

We need to pass this Bearer Token in the Embed Token and then utilise it in the Query as shown below.


let
Source = OData.Feed("https://localhost:44321/odata", null, [Headers=[Authorization = "Bearer {REMOVED}"], ODataVersion=4, Implementation="2.0", OmitValues=ODataOmitValues.Nulls]),
Users_table = Source{[Name="Users",Signature="table"]}[Data]
in
Users_table

 

This Bearer Token can not be hardcoded into the query as it needs to change per user.

 

Can someone point me in the right direction.

 

Thanks

 

Phil

  • Hi PhilSteel ,

     

    This does not seem to be able to do that, because getting the data belongs to the model level. For reports, it will only have one dataset, regardless of how many users you have.


    If follow your logic, the dataset will be refreshed every time a user logs in, and if multiple users log in to the report at the same time, it will cause the dataset to be refreshed, resulting in inconsistent data, with the next user's refresh overwriting the previous user's data.

     

    Pwoer bi report accesses the dataset and fetches data according to the defined dax, so you need to refresh all the data that all users may use into the dataset and present different data according to the user's token.
    If rls does not meet your needs, you can try OLS in power bi.

    Analysis Services tabular model object-level security | Microsoft Docs

     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Community Support

    Hi PhilSteel ,

     

    This does not seem to be able to do that, because getting the data belongs to the model level. For reports, it will only have one dataset, regardless of how many users you have.


    If follow your logic, the dataset will be refreshed every time a user logs in, and if multiple users log in to the report at the same time, it will cause the dataset to be refreshed, resulting in inconsistent data, with the next user's refresh overwriting the previous user's data.

     

    Pwoer bi report accesses the dataset and fetches data according to the defined dax, so you need to refresh all the data that all users may use into the dataset and present different data according to the user's token.
    If rls does not meet your needs, you can try OLS in power bi.

    Analysis Services tabular model object-level security | Microsoft Docs

     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.