1. For an user

$claim = New-SPClaimsPrincipalClaimValue “<name.surname@domain.com>” ClaimType http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upnTrustedIdentityTokenIssuer “Trusted_Identity_Provider_Name”

$user = New-SPUserUserAlias $claim.ToEncodedString() -Web “<url_collection_site>”

Set-SPUser -Identity $user -Web “<url_collection_site>“-Group <sharepoint_group_name>”

2. For an AD group

$claim = New-SPClaimsPrincipalClaimValue “<AD_group_name>” ClaimType http://schemas.microsoft.com/ws/2008/06/identity/claims/role TrustedIdentityTokenIssuer “Trusted_Identity_Provider_Name”

$user = New-SPUserUserAlias $claim.ToEncodedString() -Web “<url_collection_site>”

Set-SPUser -Identity $user -Web “<url_collection_site>“-Group <sharepoint_group_name>”