Is there an Azure CLI command to download a certificate's private key? I've tried "az keyvault secret download" and "az keyvault certificate download" and both give me the certificate value.
I was able to download the certificate from the Portal in pem/pfx format but when I try to use openssl to split it, it asks for an import password which I don't have or know about.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
hi @bim-msft could you pls help to have a look? Thanks.
@ynambiar Hi, for security concern, there is no way to download/show a private key from Key Vault, once it was imported/created, it can only be used via internal ways.
Okay, thanks for the info @bim-msft
@ynambiar I got both the private and public key exported using the following, worth noting in my test the certificate in keyvault had no password protection and was marked as exportable, the other key bits were using "az keyvault secret download" and in the vault URL even though its a certifcate we are after it must use "../secrets/.." instead of "../certificates/.."
az keyvault secret download --id https://
@ynambiar I got both the private and public key exported using the following, worth noting in my test the certificate in keyvault had no password protection and was marked as exportable, the other key bits were using "az keyvault secret download" and in the vault URL even though its a certifcate we are after it must use "../secrets/.." instead of "../certificates/.."
az keyvault secret download --id https://
.vault.azure.net/secrets/ --file certificate.pem
@ynambiar @mattduguid I think this documentation pretty much sums up the behavior highlighted in the solution.
Most helpful comment
@ynambiar I got both the private and public key exported using the following, worth noting in my test the certificate in keyvault had no password protection and was marked as exportable, the other key bits were using "az keyvault secret download" and in the vault URL even though its a certifcate we are after it must use "../secrets/.." instead of "../certificates/.."
az keyvault secret download --id https://.vault.azure.net/secrets/ --file certificate.pem