Forum Discussion

PallaviKGVG's avatar
PallaviKGVG
Helper I
8 years ago

Row level security with multiple roles

Hi,

 

I have a report built and pushed on to power bi service. When i am embeding the report using Azure AD, i want to get a report filtered with the clientid and locationid which can be dynamic value.

Currently, i am getting the report which filtered with client id where i am using row level security role as 'Dispensary' and filter as clientid=USERNAME() on mange roles. Since, where i use to generate token on webapplication by passing username as client id and roles as ["Dispensary"] but , now i have another condition comes in where i have to get a report based on codition that is locationid and clientid . 

 

 How can i achieve this?

 

Thanks in advance.

Pallavi K

10 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi Pallavi,

     

    It seems your embedded mode is "App Owns Data". Please refer to developer/embedded-row-level-security.

    1. I would suggest you create two roles based on locationid and clientid. One role is also good if the two fields can be combined.

    {
        "accessLevel": "View",
        "identities": [
            {
                "username": "EffectiveIdentity",
                "roles": [ "Role1", "Role2" ],
                "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ]
            }
        ]
    }

    2. If not for the sake of security, I would suggest you use slicers to make the two fields dynamic. 

     

    Best Regards,

    Dale

    • PallaviKGVG's avatar
      PallaviKGVG
      Helper I

      Thank you v-jiascu-msft.

       

      Currently, for generatingtoken with single role i am passing the post request body as 

      $clientid = "2";

      {
      "accessLevel": "View",
      "identities": [
      {
      "username": $clientid ,
      "roles": [ "Client" ],
      "datasets": [ "9b61d620-e6ac-41fc-b2c9-3f1d89241a03" ]
      }
      ]
      }

       

      Another field that comes in now is 

      $location = "3";//Can be multiple location under client

       

      Note: I may have multiple location under single client [under client 2 i may have location id 2,3,4 etc] and i have 2 different table called Clients and Locations. 

       

      In Bi desktop i have Client role created as client_id = USERNAME(); (I have duplicated client id column as string)

      How i can pass the location for username property of identities, where it takes single value?

      What can be done at the power bi desktop to create the roles for both clients and locations ?

       

       

      Thanks and regards

      Pallavi

      • v-jiascu-msft's avatar
        v-jiascu-msft
        Microsoft Employee

        Hi Pallavi,

         

        We can set many rules for one role at the same time. So we can only create one role for your scenario. Please refer to the snapshot below.

        Row_level_security_with_multiple_roles

         

        Best Regards,

        Dale