Upload PFX Cert to Azure Key Vault

When was the last time you tried to upload a certificate to the Azure Key Vault? At the time of writing, you can’t from the portal.


Good news, you can using PowerShell. Below will guide you how to upload a private key certificate to Azure Key Vault:

### Log into Azure
$Subscription = (Get-AzureRmSubscription | Out-GridView Title "Choose a Source & Target Subscription …" PassThru)
Select-AzureRmSubscription SubscriptionId $Subscription.Id
# Upload Certificate to Azure's Key Vault
$securepfxpwd = ConvertTo-SecureString –String 'password' –AsPlainText –Force # Password for the private key PFX certificate
$certificateName = 'My-Cert'
$vaultName = 'MyVault'
$cer = Import-AzureKeyVaultCertificate VaultName $vaultName Name $certificateName FilePath 'C:\My-Cert.pfx' Password $securepfxpwd




One Comment

  1. Did you happen to notice if your PFX password still worked when trying to download the secret afterward? It doesn’t. They strip out the value after you upload it. The PFX Import manager will only accept a null value as valid, I lost a couple of nights trying to figure this out.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s