Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Row Level Security WITHOUT user Email, based on userid

hey, quick question.

 

can i set up RLS without email? 

 

im looking to make RLS based on userid, can i achive this?

 

the end target is RLS with embedded PBI that based on userid parameter. 

 

how would i approach this ? would love some input. 

 

thanks 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    RLS is divided into dynamic and static, and dynamic requires the use of USERPRINCIPLENAME or USERNAME.

    Using the username() or userprincipalname() DAX function

    Depending on your requirements, you do not need to use the above two functions. You have static RLS here, which can be created after my example below.

    Create two roles. One is the role of user ID123 and the other is the role of user ID456. Because my sample data is only 123 and 465, you create multiple characters based on your sample data.

    The results of testing are as follows.

    After you save your report in Power BI Report Server, you manage security and add or remove members on the server.

    Add members to roles

     

     

    Best Regards,

    Stephen Tao

     

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

4 Replies

  • Manoj_Nair's avatar
    Manoj_Nair
    Solution Supplier

    hi Anonymous - try 

    USERPRINCIPALNAME function, RLS authorization = USERPRINCIPALNAME()

    • Anonymous's avatar
      Anonymous
      Not applicable

      hey, can you please elaborate more? 

       

      i have RLS table with userid that connects to another table (customer table) using userid column, i want lets say userid 123 to see only customer 111 (user 123 is under customer 111) 

       

      where do i need to put the USERPRINCIPALNAME? 

       

      thanks 

       

       

      • Manoj_Nair's avatar
        Manoj_Nair
        Solution Supplier

        Anonymous here is the complete solution set we simulated for you. Let me know if this works for you. RLS tutorial  & documentation explain the step-by-step process to configure your RLS.

        1. DATASETS MODEL

        2. TABLE RELATIONSHIP

         

        3. RLS ROLE PERMISSION

        4. RLS SECURITY

        5. ASSIGN USERS TO RLS ROLE

        6. FINAL OUTCOME WHEN USER LOGIN

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    RLS is divided into dynamic and static, and dynamic requires the use of USERPRINCIPLENAME or USERNAME.

    Using the username() or userprincipalname() DAX function

    Depending on your requirements, you do not need to use the above two functions. You have static RLS here, which can be created after my example below.

    Create two roles. One is the role of user ID123 and the other is the role of user ID456. Because my sample data is only 123 and 465, you create multiple characters based on your sample data.

    The results of testing are as follows.

    After you save your report in Power BI Report Server, you manage security and add or remove members on the server.

    Add members to roles

     

     

    Best Regards,

    Stephen Tao

     

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