New-AzADSpCredential
语法
SpObjectIdWithPasswordParameterSet (默认值)
New-AzADSpCredential
-ObjectId <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SpObjectIdWithCertValueParameterSet
New-AzADSpCredential
-ObjectId <String>
-CertValue <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SpObjectIdWithKeyCredentialParameterSet
New-AzADSpCredential
-ObjectId <String>
-KeyCredentials <MicrosoftGraphKeyCredential[]>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SpObjectIdWithPasswordCredentialParameterSet
New-AzADSpCredential
-ObjectId <String>
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ServicePrincipalObjectWithCertValueParameterSet
New-AzADSpCredential
-CertValue <String>
-ServicePrincipalObject <IMicrosoftGraphServicePrincipal>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ServicePrincipalObjectWithPasswordParameterSet
New-AzADSpCredential
-ServicePrincipalObject <IMicrosoftGraphServicePrincipal>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SPNWithCertValueParameterSet
New-AzADSpCredential
-CertValue <String>
-ServicePrincipalName <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SPNWithPasswordParameterSet
New-AzADSpCredential
-ServicePrincipalName <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ServicePrincipalObjectWithPasswordCredentialParameterSet
New-AzADSpCredential
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
-ServicePrincipalObject <IMicrosoftGraphServicePrincipal>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SPNWithPasswordCredentialParameterSet
New-AzADSpCredential
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
-ServicePrincipalName <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ServicePrincipalObjectWithKeyCredentialParameterSet
New-AzADSpCredential
-KeyCredentials <MicrosoftGraphKeyCredential[]>
-ServicePrincipalObject <IMicrosoftGraphServicePrincipal>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SPNWithKeyCredentialParameterSet
New-AzADSpCredential
-KeyCredentials <MicrosoftGraphKeyCredential[]>
-ServicePrincipalName <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
示例
示例 1:为服务主体创建密钥凭据
$credential = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphKeyCredential" `
-Property @{'Key' = $cert;
'Usage' = 'Verify';
'Type' = 'AsymmetricX509Cert'
}
New-AzADSpCredential -ObjectId $Id -KeyCredentials $credential
为服务主体创建密钥凭据
示例 2:为服务主体创建密码凭据
Get-AzADServicePrincipal -ApplicationId $appId | New-AzADSpCredential -StartDate $startDate -EndDate $endDate
为服务主体创建密码凭据
参数
-CertValue
“非对称”凭据类型的值。
它表示 base 64 编码的证书。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SpObjectIdWithCertValueParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithCertValueParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithCertValueParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
| 类型: | PSObject
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | AzContext, AzureRmContext, AzureCredential |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-EndDate
凭据使用情况的有效结束日期。
默认结束日期值为从今天开始的一年。
对于“非对称”类型凭据,必须将其设置为 X509 证书有效日期或之前。
参数属性
| 类型: | DateTime
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SpObjectIdWithPasswordParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SpObjectIdWithCertValueParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithCertValueParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithPasswordParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithCertValueParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithPasswordParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-KeyCredentials
与服务主体关联的密钥凭据。
参数属性
参数集
SpObjectIdWithKeyCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithKeyCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithKeyCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ObjectId
应用程序的对象 ID。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | Id, ServicePrincipalObjectId |
参数集
SpObjectIdWithPasswordParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SpObjectIdWithCertValueParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SpObjectIdWithKeyCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SpObjectIdWithPasswordCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-PasswordCredentials
与服务主体关联的密码凭据。
参数属性
参数集
SpObjectIdWithPasswordCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithPasswordCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithPasswordCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ServicePrincipalName
服务主体名称。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | SPN |
参数集
SPNWithCertValueParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithPasswordParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithPasswordCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithKeyCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ServicePrincipalObject
服务主体对象可用作管道输入。
参数属性
参数集
ServicePrincipalObjectWithCertValueParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithPasswordParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithPasswordCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithKeyCredentialParameterSet
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-StartDate
凭据使用情况的有效开始日期。
默认开始日期值为今天。
对于“非对称”类型凭据,必须设置为 X509 证书有效日期或之后的日期。
参数属性
| 类型: | DateTime
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SpObjectIdWithPasswordParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SpObjectIdWithCertValueParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithCertValueParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ServicePrincipalObjectWithPasswordParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithCertValueParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
SPNWithPasswordParameterSet
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。
命令脚本未运行。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出
备注
别名
New-AzADServicePrincipalCredential