用于在 keyvault 中创建新版本证书的 Azure CLI 或 PowerShell 命令

Azure CLI or PowerShell command to create new version of a certificate in keyvault

我想使用命令行(az cli 或 powershell)在 keyvaule 中创建新版本的证书。有人知道怎么做吗?

要创建新版本,只需使用Add-AzKeyVaultCertificate powershell命令,指定证书名称,然后它会创建一个新版本。

样本:

$Policy = New-AzKeyVaultCertificatePolicy -SecretContentType "application/x-pkcs12" -SubjectName "CN=contoso.com" -IssuerName "Self" -ValidityInMonths 6 -ReuseKeyOnRenewal
Add-AzKeyVaultCertificate -VaultName "keyvaultname" -Name "joycer" -CertificatePolicy $Policy

对于 Azure CLI,此命令 az keyvault certificate create 也应该有效。

az keyvault certificate create --name
                               --policy
                               --vault-name
                               [--disabled {false, true}]
                               [--subscription]
                               [--tags]
                               [--validity]