Share via

Let's Encrypt Certificate with Key Vault and Azure App Service Import Issues

Lucian Hanga 25 Reputation points
2024-09-29T21:47:48.62+00:00

Hi comunity,

I have a wildcard certificate issued by Let's Encrypt.

I want to use this certificate with an Azure App Service. Following the instructions, I created a password-protected .pfx file using the following command:

openssl pkcs12 \
   -export \
   -out ./cert.pfx \
   -in ./fullchain.pem \
   -inkey ./privkey.pem \
   -passout pass:test123

When I try to import this .pfx file through the Azure portal using the "Bring Your Own Certificate" option, everything works smoothly. The certificate is successfully imported, and I can bind it to the custom domain.

However, when I import the same .pfx file into Azure Key Vault as a certificate, the import itself works fine. But when I attempt to import the certificate from Key Vault into the App Service, I encounter a permissions error.

I followed the steps outlined in Microsoft's documentation and assigned the App Service's Managed Identity both the "Key Vault Certificate User" and "Key Vault Secrets User" roles. This resolved the permission error, but now, when attempting to import the certificate into the App Service, I get a generic error:

An error has occurred.

Unfortunately, no further details are provided.

Upon checking the Key Vault, I noticed that the associated secret for the certificate was created, although it doesn't appear in the list of secrets. I was able to access it by name, and it appears to be a base64-encoded version of the .pfx file.

My question is: What should I do from here? How can I debug this issue? What might be causing the problem?

The reason I need the certificate in Key Vault is to automate the process of importing the certificate into the App Service using Terraform. I also need to store the certificate in Key Vault for a future GitHub Actions workflow to handle certificate renewals.

Please let me know if you need any additional information to get a clearer understanding of the issue. I haven't provided specific details here because it involves a lot of information, including extensive tokenization of sensitive information.

Thank you,
Lucian

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.

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


1 answer

Sort by: Most helpful
  1. Sina Salam 28,361 Reputation points Volunteer Moderator
    2026-03-07T14:14:26.92+00:00

    Hello Lucian Hanga,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having Let's Encrypt Certificate with Key Vault and Azure App Service Import Issues.

    ECC/ECDSA certs cannot be imported from Key Vault into App Service. Though it worked with App Service when uploaded as a PFX - https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate

    The best practice if you need Key Vault > App Service auto‑sync: use RSA (PFX). RSA‑2048 is the standard and widely compatible, RSA‑3072/4096 also work if you prefer stronger keys. - https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate If you must use ECDSA end‑to‑end, upload the ECDSA PFX directly to App Service (not from Key Vault), since upload is supported even though Key Vault import isn’t. - https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is 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.