Unable to see 'Import' button in Key Vault secret option

Apurva Pathak 380 Reputation points
2024-05-14T04:38:49.35+00:00

Hi folks,

I am trying to upload/ renew a secret object in Key Vault, but I am unable to see import certificate option there. I certainly can recall it was previously there but now it's not.

Have there been any changes made to the KV operations recently from Azure? Has this option been permanently removed?

If yes, how can we upload the certificate files to KV secrets?

Currently available options:

User's image

Previously available options:

User's image

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,180 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Leonardo A. Barbastefano 1 Reputation point
    2024-07-11T16:30:25.71+00:00

    The solution that worked for me.

    Open Windows PowerShell ISE on your computer as an administrator.

    Run the following commands:

    Connect-AzureRmAccount -TenantId 00000000-ede9-4ad4-827d-000000000000

    $pfxFilePath = 'C:\certificate_name.pfx'

    $pwd = ''

    $flag = [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable

    $collection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection

    $collection.Import($pfxFilePath, $pwd, $flag)

    $pkcs12ContentType = [System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12

    $clearBytes = $collection.Export($pkcs12ContentType)

    $fileContentEncoded = [System.Convert]::ToBase64String($clearBytes)

    $secret = ConvertTo-SecureString -String $fileContentEncoded -AsPlainText –Force

    $secretContentType = 'application/x-pkcs12'

    Set-AzureKeyVaultSecret -VaultName 'KeyVaultName' -Name 'NewSecretName' -SecretValue $Secret -ContentType $secretContentType

    After you finish the Certificate should show up in the KeyVault under Secrets.

    0 comments No comments