Skip to content

Instantly share code, notes, and snippets.

@sahibalejandro
Last active September 13, 2023 06:38
Show Gist options
  • Save sahibalejandro/3c48d10058afccd6c705caabdb88660a to your computer and use it in GitHub Desktop.
Save sahibalejandro/3c48d10058afccd6c705caabdb88660a to your computer and use it in GitHub Desktop.
Generate PFX file from Let's Encrypt PEM files for Azure Application Service
# STEP 1
# Frist, generate PEM files using certbot docker image
docker run --rm -it -v ".:/etc/letsencrypt" certbot/certbot certonly --manual --preferred-challenges dns -d "domain.com" -d "*.domain.com"
# Follow the certbot instructions
# Remember that multiple TXT records with the same host are allowed
# so you can add TXT record for naked and wildcard validations.
# STEP 2
# Generate FPX file using Ubuntu docker image
docker run --rm -it -v ".:/home/certificates" ubuntu:focal
# Once inside the container run:
apt-get update
apt-get install openssl
cd /home/certificates
# Navigate to where your PEM files are located and run:
openssl pkcs12 -export -out certificate.pfx -inkey privkey.pem -in fullchain.pem
# STEP 3
# Got to your Azure Application Service and add the PFX file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment