New-SPClaimsPrincipal
Published: July 16, 2012
Applies to: SharePoint Foundation 2013 | SharePoint Server 2013 Enterprise
Creates a claims principal.
New-SPClaimsPrincipal [-Identity] <String> [-IdentityType] <WindowsSamAccountName | WindowsSecurityGroupName | WindowsSecurityGroupSid | FormsUser | FormsRole | EncodedClaim> [-AssignmentCollection <SPAssignmentCollection>]
New-SPClaimsPrincipal [-Identity] <String> [-TrustedIdentityTokenIssuer] <SPTrustedIdentityTokenIssuerPipeBind> [-AssignmentCollection <SPAssignmentCollection>]
New-SPClaimsPrincipal [-ClaimValue] <String> [[-ClaimType] <String>] [-TrustedIdentityTokenIssuer] <SPTrustedIdentityTokenIssuerPipeBind> [[-IdentifierClaim] <SwitchParameter>] [-AssignmentCollection <SPAssignmentCollection>]
New-SPClaimsPrincipal [-EncodedClaim] <String> [-AssignmentCollection <SPAssignmentCollection>]
New-SPClaimsPrincipal [-ClaimValue] <String> [-ClaimType] <String> [-ClaimProvider] <SPClaimProvider> [-AssignmentCollection <SPAssignmentCollection>]
Parameters
1| Parameter | Required | Type | Description | ||
| Identity | Required | System.String | Specifies the name of the new claims principal. The type must be a valid name of a claims principal. | ||
| IdentityType | Required | Microsoft.SharePoint.Administration.Claims.SPIdentifierTypes | Specifies the type of the new claims principal. The type must be one of the following: WindowsSamAccountName, WindowsSecurityGroupSid, FormsUser, FormsRole, or EncodedClaim. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
|
| Parameter | Required | Type | Description | ||
| Identity | Required | System.String | Specifies the name of the new claims principal. The type must be a valid name of a claims principal. | ||
| TrustedIdentityTokenIssuer | Required | Microsoft.SharePoint.PowerShell.SPTrustedIdentityTokenIssuerPipeBind | Specifies the ID of the authentication provider. The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; or a valid name of an Authentication provider (for example, MyAuthprovider1); or an instance of a valid SPTrustedIdentityTokenIssuer object. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
|
| Parameter | Required | Type | Description | ||
| ClaimValue | Required | System.String | Specifies the claim value of the claims object. The claims value specifies the user, group, or computer that the claim is authenticating. The type must be a valid claim value; for example, john@contoso.com. | ||
| ClaimType | Required | System.String | Specifies the type of claim to create. The value I indicates a unique user identity claim, and the value C indicates all other claims. The type must be either of the following values: I or C. | ||
| TrustedIdentityTokenIssuer | Required | Microsoft.SharePoint.PowerShell.SPTrustedIdentityTokenIssuerPipeBind | Specifies the ID of the authentication provider. The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; or a valid name of an Authentication provider (for example, MyAuthprovider1); or an instance of a valid SPTrustedIdentityTokenIssuer object. | ||
| IdentifierClaim | Optional | System.Management.Automation.SwitchParameter | Specifies if the new claim is an identity claim. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
|
| Parameter | Required | Type | Description | ||
| EncodedClaim | Required | System.String | Converts a simple claim to a full encoded claim. The type must be a valid claim value; for example, i:001w|redmond\user. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
|
| Parameter | Required | Type | Description | ||
| ClaimValue | Required | System.String | Specifies the claim value of the claims object. The claims value specifies the user, group, or computer that the claim is authenticating. The type must be a valid claim value; for example, john@contoso.com. | ||
| ClaimType | Required | System.String | Specifies the type of claim to create. The value I indicates a unique user identity claim, and the value C indicates all other claims. The type must be either of the following values: I or C. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
|
Detailed Description
This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.
The New-SPClaimsPrincipal cmdlet creates a claims principal.
Input Types
Return Types
-------------------------EXAMPLE 1-----------------------------
New-SPSite http://sitename/sites/newsite -owner (New-SPClaimsPrincipal contoso\johndoe -TrustedIdentityTokenIssuer "NTLM")
This example creates a claim principal for a Windows user.
-------------------------EXAMPLE 2-----------------------------
New-SPSite http://localhost/sites/newsite -owner (New-SPClaimsPrincipal contoso\allusers -TrustedIdentityTokenIssuer "NTLM")
This example creates a claim principal for a Windows group.
-------------------------EXAMPLE 3-----------------------------
New-SPSite http://sitename/sites/newsite -owner (New-SPClaimsPrincipal -ClaimValue "john@contoso.com" –ClaimType Email –TrustedIdentityTokenIssuer "LiveID STS" –IdentifierClaim Yes)
This example creates a claim principal for a trusted identity token issuer claim.
-------------------------EXAMPLE 4-----------------------------
$ip = New-SPIdentityProvider –ASPNetMembershipProvider "myMembershipProvider" –ASPNetRoleProvider "myRoleProvider"
New-SPSite http://sitename/sites/newsite -owner (New-SPClaimsPrincipal "john@contoso.com" -TrustedIdentityTokenIssuer $ip)
This example creates a claim principal for a ASPNet Membership User.
-------------------------EXAMPLE 5-----------------------------
New-SPSite http://sitename/sites/newsite -owner (New-SPClaimsPrincipal "Sales Manager Role" -IdentityProvider "myRoleProvider")
This example creates a claim principal for a ASPNet Role.
-------------------------EXAMPLE 6-----------------------------
$cp = New-SPClaimsPrincipal -Identity "redmond\SiteOwner" -IdentityType 1
New-SPSite http://servername:port -OwnerAlias $cp.ToEncodedString() -Template "STS#0"
This example creates a claim principal for a Basic Claim Role, which is also called an encoded claim).
Change History
| Date | Description |
|---|---|
| July 16, 2012 | Initial publication |

Note: