Below is an example powershell script for Linking your Sharepoint Group name with the RoleClaim: "link-groups.ps1"


# Determines a directory where this script is placed
$ScriptDirectory = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
 
# Includes common configuration
. (Join-Path $ScriptDirectory claims-authn-sso-common.ps1)


$groupName = "SharePoint Group"
$roleClaim = "NameOfRole"

 
$sts = Get-SPTrustedIdentityTokenIssuer $idpName
$claimPrincipal = New-SPClaimsPrincipal -ClaimValue $roleClaim -ClaimType "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" -TrustedIdentityTokenIssuer $sts
 
$web = Get-SPWeb $webApplicationName
$user = New-SPUser -UserAlias $claimPrincipal.ToEncodedString() -Web $web

$group = $web.SiteGroups[$groupName]
$group.AddUser($user)


  1. Replace "SharePoint Group". with the actual name of your SharePoint Group.
  2. Replace "NameOfRole". With the name of the role claim you wish to link your Group to.
  • No labels