Forum Discussion
Gow_tham
1 year agoFrequent Visitor
How can I programmatically add or remove users for a Power BI dataset, given the following scenario?
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 ...
Anonymous
1 year agoNot applicable
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.
Gow_tham
1 year agoFrequent Visitor
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.