The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
how we can implement or Add user in RLS Power BI via REST API,
i found some of scanner API but it give us only Get Access.
how could implement this ?
Solved! Go to Solution.
Hey,
based on my knowlegde, there is no REST API support as of today to add users/groups within RLS in power BI
Thanks for the reply from Jai-Rathinavel and NandanHegde , please allow me to provide another insight:
Hi, @mohitkumawat
Could you please let me know if the responses from Jai-Rathinavel and NandanHegde have resolved your issue?If it did, kindly accept it as the solution.
I agree with their suggestion; PowerShell is a good alternative. However, please note that you cannot directly add users to RLS via the PowerShell API. Here is a link to the relevant issue:
Solved: How to add a member to a RLS via Power Shell, API ... - Microsoft Fabric Community
Therefore, you need to first create a security group and then automatically add users from, for example, a CSV file to the security group. Below is a sample code:
# Start transcript
Start-Transcript -Path C:\Temp\Add-ADUsers.log -Append
# Import AD Module
Import-Module ActiveDirectory
# Import the data from CSV file and assign it to variable
$Users = Import-Csv "C:\Temp\Users.csv"
# Specify target group name (pre-Windows 2000) where the users will be added to
# You can add the distinguishedName of the group. For example: CN=Pilot,OU=Groups,OU=Company,DC=exoip,DC=local
$Group = "Pilot"
foreach ($User in $Users) {
# Retrieve UPN
$UPN = $User.UserPrincipalName
# Retrieve UPN related SamAccountName
$ADUser = Get-ADUser -Filter "UserPrincipalName -eq '$UPN'" | Select-Object SamAccountName
# User from CSV not in AD
if ($ADUser -eq $null) {
Write-Host "$UPN does not exist in AD" -ForegroundColor Red
}
else {
# Retrieve AD user group membership
$ExistingGroups = Get-ADPrincipalGroupMembership $ADUser.SamAccountName | Select-Object Name
# User already member of group
if ($ExistingGroups.Name -eq $Group) {
Write-Host "$UPN already exists in $Group" -ForeGroundColor Yellow
}
else {
# Add user to group
Add-ADGroupMember -Identity $Group -Members $ADUser.SamAccountName -WhatIf
Write-Host "Added $UPN to $Group" -ForeGroundColor Green
}
}
}
Stop-Transcript
For further details, please refer to:
Solved: Adding users to role on power bi service automatic... - Microsoft Fabric Community
Add users to group with PowerShell - ALI TAJRAN
https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal?tabs=azure-por...
New-MgGroupMember: Add Members to Groups Easily | M365Corner
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@mohitkumawat You can add members to the role via powershell cmdlet but not via Power BI Rest APIs at moment.
Thanks,
Jai
Proud to be a Super User! | |
Hey,
based on my knowlegde, there is no REST API support as of today to add users/groups within RLS in power BI