I am trying to install KeyVaultForLinux extensions 4.x version in my ubuntu 24.04 but facing issues

2026-08-28T07:14:45.1533333+00:00

Hi Team,

I am trying to install the KeyVaultForLinux extension (4.x) on an Ubuntu 24.04 VM, but I am encountering an issue during deployment.

Environment Details:

  • Using the VM's Managed Identity for authentication.
  • The Managed Identity already has the required access permissions to the Azure Key Vault (AKV).

Issue: The deployment fails during the certificate and private key validation step. The error indicates a certificate/key mismatch.

However:

  • The certificate stored in the Key Vault is valid and has been in use for a long time without any issues.
  • The certificate was originally uploaded to the Key Vault as a PFX.
  • Manual validation of the certificate and private key does not show any mismatch.
  • Other services using the same certificate have been working successfully. (EX: in AppGW with AKV linked)

Since the certificate can be retrieved successfully but the validation fails only within the KeyVaultForLinux extension, I would like to understand:

  1. Is there any bug from Microsoft side which is failing for this validation?
  2. Are there additional validation requirements enforced by the extension that could cause this mismatch error?
  3. Any guidance would be greatly appreciated.

Error:

2026-08-28 06:42:55: <info> [CertificateManager] Installing previous version '91129cb365f64212afe20097a46f5d30' of 'https://<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>'

2026-08-28 06:42:55: <debug> [AuthClientDelegator] delegating to MSI auth client

2026-08-28 06:42:55: <debug> [AuthClient] acquiring token

2026-08-28 06:42:55: <debug> [UnixKeyVaultHttpClient] Using CAfile for TLS: /etc/ssl/certs/ca-certificates.crt

2026-08-28 06:42:55: <debug> [UnixKeyVaultHttpClient] Using CApath for TLS: /etc/ssl/certs

2026-08-28 06:42:55: <info> [UnixCertificateStore] attempting to open store '/etc/nginx/test-ssl'

2026-08-28 06:42:55: <info> [Certificate] Loaded 2 intermediate/root certificate(s) from PEM

2026-08-28 06:42:55: <error> [CertificateManager] Refreshing 'https://<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>' failed with exception: InitFromPEM: Mismatched X509 and private key.: error:05800074:x509 certificate routines::key values mismatch

2026-08-28 06:42:55: <error> [CertificateManager] Failed to install previous version '91129cb365f64212afe20097a46f5d30' of 'https://<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>'

2026-08-28 06:42:55: <error> [CertificateManager] Failed to download one or more certificates.

2026-08-28 06:42:55: <error> [CertificateManager] Retrying after failed download cycle.

2026-08-28 06:42:55: <info> [CertificateManager] Next poll in 45 seconds.

2026-08-28 06:42:55: <info> [UnixCertificateManager] Checking state of termination event with a timeout of 45999

2026-08-28 06:43:41: <debug> [CertificateManager] POLLING_RANDOMIZATION_RANGE_SEC: 300, RandomMS: 179000

2026-08-28 06:43:41: <info> [CertificateManager] Starting refreshing observed certificates...

2026-08-28 06:43:41: <info> [CertificateManager] Beginning refresh for: https://<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>

2026-08-28 06:43:41: <debug> [AuthClientDelegator] delegating to MSI auth client

2026-08-28 06:43:41: <debug> [AuthClient] acquiring token

2026-08-28 06:43:41: <debug> [UnixKeyVaultHttpClient] Using CAfile for TLS: /etc/ssl/certs/ca-certificates.crt

2026-08-28 06:43:41: <debug> [UnixKeyVaultHttpClient] Using CApath for TLS: /etc/ssl/certs

2026-08-28 06:43:42: <info> [CertificateManager] Installing previous version '91129cb365f64212afe20097a46f5d30' of 'https://<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>'

2026-08-28 06:43:42: <debug> [AuthClientDelegator] delegating to MSI auth client

2026-08-28 06:43:42: <debug> [AuthClient] acquiring token

2026-08-28 06:43:42: <debug> [UnixKeyVaultHttpClient] Using CAfile for TLS: /etc/ssl/certs/ca-certificates.crt

2026-08-28 06:43:42: <debug> [UnixKeyVaultHttpClient] Using CApath for TLS: /etc/ssl/certs

2026-08-28 06:43:42: <info> [UnixCertificateStore] attempting to open store '/etc/nginx/test-ssl'

2026-08-28 06:43:42: <info> [Certificate] Loaded 2 intermediate/root certificate(s) from PEM

2026-08-28 06:43:42: <error> [CertificateManager] Refreshing 'https://<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>' failed with exception: InitFromPEM: Mismatched X509 and private key.: error:05800074:x509 certificate routines::key values mismatch

2026-08-28 06:43:42: <error> [CertificateManager] Failed to install previous version '91129cb365f64212afe20097a46f5d30' of '<ForSecurityRemovedAKVName>.vault.azure.net/secrets/<RemovingCertName>'

2026-08-28 06:43:42: <error> [CertificateManager] Failed to download one or more certificates.

2026-08-28 06:43:42: <error> [CertificateManager] Retrying after failed download cycle.

2026-08-28 06:43:42: <info> [CertificateManager] Next poll in 33 seconds.

2026-08-28 06:43:42: <info> [UnixCertificateManager] Checking state of termination event with a timeout of 33999

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.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Jose Benjamin Solis Nolasco 12,281 Reputation points Volunteer Moderator
    2026-08-30T23:52:22.02+00:00

    Welcome to Microsoft Q&A!

    Hello @Indukuri, Bala Sai Varma(IT) (Consultant)

     

    The error key values mismatch occurs because the KeyVaultForLinux extension uses strict OpenSSL validation that requires the leaf (end-entity) certificate to be the very first certificate in the bundle. While services like Application Gateway automatically match the private key across the bundle, Linux fails if an intermediate or root CA certificate is placed before the leaf.

     

    Additionally, notice this line in your log:

    Installing previous version '91129cb365f64212afe20097a46f5d30'

     

    The extension downloads both the current and the previous version. If that older version has an improper chain order, the entire extension fails.

    Try this it worked for me a little while ago:

    1. Disable the Broken Older Version

    • Go to Azure Key Vault > Certificates > select your certificate.
    • Open the Older Versions list, click version 91129cb365f64212afe20097a46f5d30, and set Enabled to No. This stops the extension from trying to install it.

    2. Rebuild the Certificate Bundle (Leaf First)

    When uploading a new PFX/PEM, ensure the chain is ordered strictly as: Leaf Certificate -> Intermediate CA -> Root CA.

    Bash

    # Combine with the leaf certificate first

    cat leaf.crt intermediate.crt root.crt > fullchain.crt

     

    # Export to PFX

    openssl pkcs12 -export -out newcert.pfx -inkey private.key -in fullchain.crt

    Upload the newly generated PFX as a new version to Key Vault, and the extension will sync successfully.

     

    References:

    Help make this community better for everyone: if this answer resolved your issue, please accept it or leave an upvote. If not, share more details in a comment so we can continue the discussion and find the right solution.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.