New-SPClaimsPrincipal
建立宣告主體。
Syntax
New-SPClaimsPrincipal
[-ClaimValue] <String>
[[-ClaimType] <String>]
[-TrustedIdentityTokenIssuer] <SPTrustedIdentityTokenIssuerPipeBind>
[-IdentifierClaim]
[-AssignmentCollection <SPAssignmentCollection>]
[<CommonParameters>]
New-SPClaimsPrincipal
[-ClaimValue] <String>
[-ClaimType] <String>
[-AssignmentCollection <SPAssignmentCollection>]
-ClaimProvider <SPClaimProvider>
[<CommonParameters>]
New-SPClaimsPrincipal
[-EncodedClaim] <String>
[-AssignmentCollection <SPAssignmentCollection>]
[<CommonParameters>]
New-SPClaimsPrincipal
[-Identity] <String>
[-IdentityType] <SPIdentifierTypes>
[-AssignmentCollection <SPAssignmentCollection>]
[<CommonParameters>]
New-SPClaimsPrincipal
[-Identity] <String>
[-TrustedIdentityTokenIssuer] <SPTrustedIdentityTokenIssuerPipeBind>
[-AssignmentCollection <SPAssignmentCollection>]
[<CommonParameters>]
Description
此 Cmdlet 包含一個以上的參數集。 您可能只使用一個參數集中的參數,但不可以結合不同參數集的參數。 如需如何使用參數集的詳細資訊,請參閱 Cmdlet 參數集。
New-SPClaimsPrincipal cmdlet 會建立宣告主體。
如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet。
範例
-------------------------範例 1-----------------------------
New-SPSite https://sitename/sites/newsite -owner (New-SPClaimsPrincipal contoso\johndoe -TrustedIdentityTokenIssuer "NTLM")
此範例會建立 Windows 使用者的宣告主體。
-------------------------範例 2-----------------------------
New-SPSite https://localhost/sites/newsite -owner (New-SPClaimsPrincipal contoso\allusers -TrustedIdentityTokenIssuer "NTLM")
此範例會建立 Windows 群組的宣告主體。
-------------------------範例 3-----------------------------
New-SPSite https://sitename/sites/newsite -owner (New-SPClaimsPrincipal -ClaimValue "john@contoso.com" -ClaimType Email -TrustedIdentityTokenIssuer "LiveID STS" -IdentifierClaim Yes)
此範例會建立信任的身分識別 Token 發行者宣告的宣告主體。
-------------------------範例 4-----------------------------
$ip = New-SPIdentityProvider -ASPNetMembershipProvider "myMembershipProvider" -ASPNetRoleProvider "myRoleProvider"
New-SPSite https://sitename/sites/newsite -owner (New-SPClaimsPrincipal "john@contoso.com" -TrustedIdentityTokenIssuer $ip)
此範例會建立 ASPNet 成員資格使用者的宣告主體。
-------------------------範例 5-----------------------------
New-SPSite https://sitename/sites/newsite -owner (New-SPClaimsPrincipal "Sales Manager Role" -IdentityProvider "myRoleProvider")
此範例會建立 ASPNet 角色的宣告主體。
-------------------------範例 6-----------------------------
$cp = New-SPClaimsPrincipal -Identity "redmond\SiteOwner" -IdentityType 1
New-SPSite https://servername:port -OwnerAlias $cp.ToEncodedString() -Template "STS#0"
此範例會建立基本宣告角色 (也稱為編碼宣告) 的宣告主體。
參數
-AssignmentCollection
管理物件以適當處置它們。 使用 SPWeb 或 SPSite 等物件可能會耗用大量的記憶體,因此在 Windows PowerShell 指令碼中使用這些物件時,必須適當地管理記憶體。 您可以使用 SPAssignment 物件將物件指派給變數,並在不需要時處置這些物件,以釋放記憶體。 使用 SPWeb、SPSite 或 SPSiteAdministration 物件時,若未使用指派集合或 Global 參數,將會自動處置這些物件。
使用 Global 參數時,所有物件會包含在全域儲存區內。 若未立即使用物件,或未使用 Stop-SPAssignment 命令處置物件,將會發生記憶體不足的狀況。
Type: | SPAssignmentCollection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ClaimProvider
指定會包含宣告主體的安全性憑證服務身分識別提供者。
此類型必須是格式為 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID;有效的識別身分提供者名稱 (例如 MyIDprovider1);或有效之 SPIdentityProvider 物件的執行個體。
Type: | SPClaimProvider |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ClaimType
指定要建立的宣告類型。 值 I 表示唯一的使用者身分宣告,值 C 則表示所有其他宣告。
此類型必須是下列兩值的其中之一:I 或 C。
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ClaimValue
指定宣告物件的宣告值。 宣告值會指定此宣告要驗證的使用者、群組或電腦。
類型必須是有效的宣告值;例如, john@contoso.com 。
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-EncodedClaim
將簡易宣告轉換成完整編碼的宣告。
此類型必須是有效的宣告值,例如 i:001w|redmond\user。
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-IdentifierClaim
指定新的宣告是否為身分宣告。
Type: | SwitchParameter |
Position: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Identity
指定新宣告主體的名稱。
此類型必須是有效的宣告主體名稱。
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-IdentityType
指定新的宣告主體類型。
此類型必須是下列其中一項: WindowsSamAccountName 、 WindowsSecurityGroupSid 、 FormsUser 、 FormsRole 或 EncodedClaim 。
Type: | SPIdentifierTypes |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-TrustedIdentityTokenIssuer
指定驗證提供者的識別碼。
此類型必須是格式為 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID、有效的驗證提供者名稱 (例如,MyAuthprovider1),或有效之 SPTrustedIdentityTokenIssuer 物件的執行個體。
Type: | SPTrustedIdentityTokenIssuerPipeBind |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |