You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to remove a hidden permission on "everyone except external users" from a site using PnP PowerShell.
I added a read permission to "everyone except external user" on a specific list. At first, the current site was not open to "everyone except external user". (no read permission to everyone except external users)
I added a read permission for the everyone except external users on that list but, at the same time, a new hidden roleassignement was added to the site. (Everyone except external users has "limited access" on the site and this was a hidden one)
By running below, I can get the role assignments from the site.
DEV537 Owners - Full Control
DEV537 Visitors - Read
DEV537 Members - Contribute
c:0-.f|rolemanager|spo-grid-all-users/xxx - Limited Access
So, I removed again the read permission of the "everyone except external users" on the list above. But, the "limieted access" permission for "everyone except external users" on the current site was not removed. That means, everyone except external users can have limited access on that site even though the site permission shows it's not open to everyone. Actually, anyone can run the "Get-PnPList" using PnP PowerShell but they can't access to the site on the portal.
I tried to remove the roleassignement "c:0-.f|rolemanager|spo-grid-all-users/xxx - Limited Access" from the site but it's not working for that hidden roleassignment.
Name RoleTypeKind Hidden Order
---- ------------ ------ -----
Limited Access Guest True 160
$web = Get-PnPWeb -Includes RoleAssignments
foreach ($ra in $web.RoleAssignments)
{
$ra.Member.LoginName
if ($ra.Member.LoginName -ne "c:0-.f|rolemanager|spo-grid-all-users/$(Get-PnPTenantID)")
{
continue;
}
foreach ($rdb in $ra.RoleDefinitionBindings)
{
if ($rdb.Name -eq "Limited Access")
{
Write-Host ($rdb.Name);
$ra.RoleDefinitionBindings.Remove($rdb);
$ra.Update();
}
}
}
Invoke-PnPQuery
$web.Update();
Invoke-PnPQuery
I can remove the DEV537 Visitors group for testing but, the hidden group was not removed using the above same scripts.
c:0-.f|rolemanager|spo-grid-all-users/xxx - Limited Access
Anyone knows how to remove the hidden permission which is assigned to "everyone except external users" on a current site?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'd like to remove a hidden permission on "everyone except external users" from a site using PnP PowerShell.
I added a read permission to "everyone except external user" on a specific list. At first, the current site was not open to "everyone except external user". (no read permission to everyone except external users)
Set-PnPListPermission -Identity $listId -User "c:0-.f|rolemanager|spo-grid-all-users/$(Get-PnPTenantID)" -AddRole "Read"
I added a read permission for the everyone except external users on that list but, at the same time, a new hidden roleassignement was added to the site. (Everyone except external users has "limited access" on the site and this was a hidden one)
By running below, I can get the role assignments from the site.
This is the result of the above commands.
So, I removed again the read permission of the "everyone except external users" on the list above. But, the "limieted access" permission for "everyone except external users" on the current site was not removed. That means, everyone except external users can have limited access on that site even though the site permission shows it's not open to everyone. Actually, anyone can run the "Get-PnPList" using PnP PowerShell but they can't access to the site on the portal.
I tried to remove the roleassignement "c:0-.f|rolemanager|spo-grid-all-users/xxx - Limited Access" from the site but it's not working for that hidden roleassignment.
I can remove the DEV537 Visitors group for testing but, the hidden group was not removed using the above same scripts.
c:0-.f|rolemanager|spo-grid-all-users/xxx - Limited Access
Anyone knows how to remove the hidden permission which is assigned to "everyone except external users" on a current site?
Beta Was this translation helpful? Give feedback.
All reactions