你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzApiManagementCertificate
创建在使用后端进行身份验证期间使用的 API 管理证书。
语法
New-AzApiManagementCertificate
-Context <PsApiManagementContext>
[-CertificateId <String>]
[-PfxFilePath <String>]
[-PfxPassword <String>]
[-KeyVault <PsApiManagementKeyVaultEntity>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzApiManagementCertificate
-Context <PsApiManagementContext>
[-CertificateId <String>]
[-PfxBytes <Byte[]>]
[-PfxPassword <String>]
[-KeyVault <PsApiManagementKeyVaultEntity>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
New-AzApiManagementCertificate cmdlet 创建 Azure API 管理证书。
示例
示例 1:创建和上传证书
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
New-AzApiManagementCertificate -Context $ApiMgmtContext -PfxFilePath "C:\contoso\certificates\apimanagement.pfx" -PfxPassword "1111"
此命令将证书上传到 Api 管理。 此证书可用于使用策略通过后端进行相互身份验证。
示例 2
创建在使用后端进行身份验证期间使用的 API 管理证书。 (自动生成)
New-AzApiManagementCertificate -CertificateId '0123456789' -Context <PsApiManagementContext> -PfxFilePath 'C:\contoso\certificates\apimanagement.pfx' -PfxPassword '1111'
示例 3:创建 keyVault 证书
$secretIdentifier = 'https://contoso.vault.azure.net/secrets/xxxx'
$keyvault = New-AzApiManagementKeyVaultObject -SecretIdentifier $secretIdentifier
$keyVaultcert = New-AzApiManagementCertificate -Context $context -CertificateId $kvcertId -KeyVault $keyvault
第一个命令创建 keyvault。 第二个命令使用此 keyvault 中的机密创建证书。
参数
-CertificateId
指定要创建的证书的 ID。 如果未指定此参数,则会为你生成 ID。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Context
指定 PsApiManagementContext 对象。
类型: | PsApiManagementContext |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-KeyVault
用于提取证书数据的 KeyVault。如果未指定 -PfxFilePath,则此参数是必需的。 有关详细信息,请参阅 New-AzApiManagementKeyVaultObject。
类型: | PsApiManagementKeyVaultEntity |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-PfxBytes
以 .pfx 格式指定证书文件的字节数组。 如果未指定 PfxFilePath 参数,则需要此参数。
类型: | Byte[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-PfxFilePath
以 .pfx 格式指定要创建和上传的证书文件的路径。 如果未指定 PfxBytes 参数,则需要此参数。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-PfxPassword
指定证书的密码。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
输入
Byte[]