Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I'm overhauling the RLS setup for master datasets in my organization, which has around 1000 active users. We have 9 fixed security roles, and users move between these roles monthly. While we can use existing security groups for some roles, we don't have permission to create new security groups for others. This forces us to manually add or remove members in the Power BI Service.
Creating new security groups is out of scope.
Is there a way to automate this process using APIs or PowerShell?
Hi, @Gow_tham
Maybe you can use PowerShell to manage users in Power BI. Here’s a simplified example:
# Install the Power BI module
Install-Module -Name MicrosoftPowerBIMgmt
# Connect to Power BI
Connect-PowerBIServiceAccount
# Add a user to a role
Add-PowerBIRoleMember -GroupId $groupId -DatasetId $datasetId -RoleId $roleId -UserPrincipalName $userEmail
# Remove a user from a role
Remove-PowerBIRoleMember -GroupId $groupId -DatasetId $datasetId -RoleId $roleId -UserPrincipalName $userEmail
You can check the following links:
Power BI Cmdlets reference | Microsoft Learn
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Anonymous ,
Upon testing, I received an error stating that there is no PowerShell cmdlet named AddPowerBIRoleMember. I searched for this cmdlet in the PowerShell reference links but couldn't find any reference to it.
Note: I have installed the MicrosoftPowerBIMgmt PowerShell module.
@Gow_tham to my knowledge there are no Rest API's or XMLA approaches to add users / members to a RLS role. It is possible to create Roles dynamically using semantic-link python library but the members cannot be added to or removed form the roles created. The best option is to have a security group for each role, but you stated it is out of scope in your current project. Not sure about the powershell route.
Did I answer your question. If yes, please accept my post as a solution.
Thanks,
Jai
Proud to be a Super User! | |
Thanks @Jai-Rathinavel
After checking out the community forums and talking to some MVPs, it looks like there aren't any REST APIs or PowerShell cmdlets to add users to a role programmatically (like you said). I've added this idea to the PowerBI Ideas forum. Meanwhile, I'm working on convincing my IT team/administrators to use security groups for different roles in the dataset and manage access that way. I have a PowerShell script that can add users to a security group from a CSV file. If you know any other easy ways to add users to a security group, let me know!
Cheers,
Gowtham
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!