Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
SilentM
Regular Visitor

AD group name gets changed when adding Row Level Security

I have created a dashbaord that is meant to only show the data for the current logged in user. I followed the directions at Row-level security (RLS) in Power BI Report Server - Power BI | Microsoft Learn to set up Row Level Security to accomplish it and it works when I explicitly add a users username as a member on the Report Server. 

 

The issue I am running into is when I try to add one of our AD groups as a member, the name of the group gets an extra space added to it after it is added. I have tried multiple times typing it correctly and have double checked that it is the correct name in AD, but every time I save it the extra space is added. If I try to add the correctly typed group name while the group with an extra space is in the list, it errors out and says that something went wrong. Since the name has the extra space in it, it doesn't show a user their data on the dashboard if they are in the group. 

 

For example, I'll type in the AD group (not the actual group but same structure): "IT-GROUP-Name" and when it saves it is changed to "IT-GROUP- Name". There is an extra space added after the second dash. 

 

Any ideas?

Thank you

1 REPLY 1
sarada
Frequent Visitor

That is strange!! 
Try to use script to add the AD group to RLS. here is powershell script you can use to update it.

$ReportServerUri = "https://<server_name>/PBIReports
#API to get roles and role assignments
$RoleAssignmentsPath = $ReportServerUri + "/api/v2.0/PowerBIReports(Path='<ReportPath>')/DataModelRoleAssignments"
$RolesPath = $ReportServerUri + "/api/v2.0/PowerBIReports(Path='<ReportPath>')/DataModelRoles"

#call API - row level security
$RoleAssignments = Invoke-RestMethod -Uri $RoleAssignmentsPath -ContentType "application/json" -UseDefaultCredentials -Method Get
#call API - RLS role
$Roles = Invoke-RestMethod -Uri $RolesPath -ContentType "application/json" -UseDefaultCredentials -Method Get

#Get roleId 
$RoleId = $Roles.value[0].ModelRoleId

$NewRoleAssignments = @( [pscustomobject]@{GroupUserName='<ADGroupName>';DataModelRoles=@($RoleId)} )
$RoleAssignmentsResult = $RoleAssignments.value + $NewRoleAssignments 
$RoleAssignmentsjson = $RoleAssignmentsResult | ConvertTo-Json
 
Invoke-RestMethod -Uri $RoleAssignmentsPath  -ContentType "application/json" -Body $RoleAssignmentsjson -UseDefaultCredentials -Method Put
 
note that in above script if your report is in root folder of PBIRS portal then  <ReportPath>  is /report_name
hope this fix your issue!         

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.