A0r
A0r

Reputation: 15

Azure KeyVault list pending certificate requests

I'm automating certificate request in Azure Key Vault and I would like to list all certificate operations (In progress, Failed or Cancelled) without knowing the exact certificate name in specific key vault, using powershell so that I can figure out if a new request needs to be created or just wait for approval if there is an existing request. It is only possible to list completed requests without knowing the certificate name.

The following command will only list completed certificates and I need those in progress, failed or cancelled to be listed.

  Get-AzureKeyVaultCertificate -VaultName $VaultName 

Any ideas on this?

Upvotes: 0

Views: 2979

Answers (2)

A0r
A0r

Reputation: 15

Looks like this is not possible to achive using current stable AzureRM.KeyVault module (5.0.0) but there is a preview version 5.1.0 that supports listing certificates in a pending state. Just tested that version and yes it does what I want but must wait until it hits stable version.

https://www.powershellgallery.com/packages/AzureRM.KeyVault/5.1.0-preview

Anybody have a workaround until key vault module is stable?

Upvotes: 1

Nancy Xiong
Nancy Xiong

Reputation: 28224

You can get the certificate status one by one through this command:

Get-AzureKeyVaultCertificateOperation

update


you can use following scripts to achieve that:

$certs = Get-AzureKeyVaultCertificate -VaultName nancykeyvault

foreach ($cert in $certs)
{
  Get-AzureKeyVaultCertificateOperation -VaultName nancykeyvault -Name $cert.Name
}  

enter image description here

Upvotes: 1

Related Questions