Forum Discussion

gabrielenicosia's avatar
gabrielenicosia
Frequent Visitor
9 months ago
Solved

How to migrate RLS roles assignment between datasets

I have two Power BI datasets (source and target) with identical RLS roles.
In the source dataset, users and groups are already assigned to these roles.

In the target dataset, the roles exist but have no users or groups assigned yet.

 

I've already migrated dataset access using a powershell script (API) and created the RLS roles using TMDL, but I need to copy all role assignments from source to target.

powershell and tabular editor seem to be not helpful in this case. Maybe i'm wrong though.

 

Do you have any ideas?

  • The solution turned out to be much simpler than expected!

    All you need to do is open two instances of Tabular Editor:

    1. In the first instance, go to File > Open > Model from DB to open the Source Dataset.

    2. In the second, open the Target Dataset.

    3. Simply copy the desired roles from the Source Dataset and paste them into the Roles folder of the Target Dataset.

    Finally, hit Ctrl + S and then Model > Deploy.

    That's all there is to it! Sometimes the easiest solution is hiding in plain sight lol

10 Replies

    • Mauro89's avatar
      Mauro89
      Icon for Super User rankSuper User

      Oh tayloramy @that Sounds interesting. Never tried this. Thanks worse trying. But this also is not capable of doing some kind of automated copy of one security setup to another new one right?

    • gabrielenicosia's avatar
      gabrielenicosia
      Frequent Visitor

      The solution turned out to be much simpler than expected!

      All you need to do is open two instances of Tabular Editor:

      1. In the first instance, go to File > Open > Model from DB to open the Source Dataset.

      2. In the second, open the Target Dataset.

      3. Simply copy the desired roles from the Source Dataset and paste them into the Roles folder of the Target Dataset.

      Finally, hit Ctrl + S and then Model > Deploy.

      That's all there is to it! Sometimes the easiest solution is hiding in plain sight lol

      • Mauro89's avatar
        Mauro89
        Icon for Super User rankSuper User

        Interesting and awesome!
        May I ask you gabrielenicosia  to share if you deploy to an SSAS instance or which instance?
        Iam curious if this works in a Fabric environment as well. I just tried and through simply publishing the updated PBI report with the model.bim was not showing the new assignments.

    • gabrielenicosia's avatar
      gabrielenicosia
      Frequent Visitor

      Hello tayloramy,

      Thanks for your reply. While the article explains how to create a new role using Tabular Editor, I actually need to copy all existing roles and assignments from one model to another in a single operation.

    • gabrielenicosia's avatar
      gabrielenicosia
      Frequent Visitor

      Hello Mauro,

      Thank you so much for your reply. That's a very interesting article; however, in my case, I need to duplicate the single user/group assignments that I made in the Power BI Service from the source model to the target model.

      • Mauro89's avatar
        Mauro89
        Icon for Super User rankSuper User

        Hi gabrielenicosia 

         

        Ok got it. Another thing which came into my mind is, also best practice ;-), to not assign single users to the RLS roles, rather than managing the users in a Entra ID group. This lets you assign a single group to both semantic models and you do not need to assign every single user every single time. Also this is less error prone as you manage the relation once in the group. No need to maintaine the roles in both semantic models.

         

        Best regards!

        PS: if you find this helpful leave some kudos and mark it as solution.