Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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)


...