# Using WSL and Let's Encrypt to create Azure App Service SSL Wildcard Certificates

DevFeed: [Using WSL and Let's Encrypt to create Azure App Service SSL Wildcard Certificates](<https://devfeed.tech/articles/using-wsl-and-let-s-encrypt-to-create-azure-app-service-ssl-wildcard-certificates-21859.md>)

Original publisher: [Read original article](<https://www.hanselman.com/blog/using-wsl-and-lets-encrypt-to-create-azure-app-service-ssl-wildcard-certificates>)

Author: Scott Hanselman

Published: 2023-06-27T17:17:25Z

Content type: tutorial

Language: en

Sources: [Scott Hanselman](<https://devfeed.tech/sources/scott-hanselman.md>)

Topics: [Azure](<https://devfeed.tech/topics/azure.md>), [Windows Subsystem for Linux](<https://devfeed.tech/topics/wsl.md>), [SSL](<https://devfeed.tech/topics/ssl.md>), [openssl](<https://devfeed.tech/topics/openssl.md>), [apt](<https://devfeed.tech/topics/apt.md>), [pip](<https://devfeed.tech/topics/pip.md>)

Tags: [apt](<https://devfeed.tech/tags/apt.md>), [azure](<https://devfeed.tech/tags/azure.md>), [certificates](<https://devfeed.tech/tags/certificates.md>), [dns](<https://devfeed.tech/tags/dns.md>), [install](<https://devfeed.tech/tags/install.md>), [openssl](<https://devfeed.tech/tags/openssl.md>), [password](<https://devfeed.tech/tags/password.md>), [private-key](<https://devfeed.tech/tags/private-key.md>), [ssl](<https://devfeed.tech/tags/ssl.md>), [windows](<https://devfeed.tech/tags/windows.md>), [wsl](<https://devfeed.tech/tags/wsl.md>)

## AI overview

This tutorial explains how to use Certbot in Windows Subsystem for Linux with Let's Encrypt to create a wildcard certificate, convert it to a password-protected PFX containing the certificate chain, and upload it to Azure App Service. It also describes importing and exporting the certificate in Windows before updating the App Service binding.

## Source excerpt

There are many let's encrypt automatic tools for azure but I also wanted to see if I could use certbot in wsl to generate a wildcard certificate for the azure Friday website and then upload the resulting certificates to azure app service. Azure app service ultimately needs a specific format called dot PFX that includes the full certificate path and all intermediates. Per the docs, App Service private certificates must meet the following requirements: Exported as a password-protected PFX file, encrypted using triple DES. Contains private key at least 2048 bits long Contains all intermediate certificates and the root certificate in the certificate chain. If you have a PFX that doesn't meet all these requirements you can have Windows reencrypt the file. I use WSL and certbot to create the cert, then I import/export in Windows and upload the resulting PFX. Within WSL, install certbot: sudo apt update sudo apt install python3 python3-venv libaugeas0 sudo python3 -m venv /opt/certbot/ sudo /opt/certbot/bin/pip install --upgrade pip sudo /opt/certbot/bin/pip install certbot Then I generate the cert. You'll get a nice text UI from certbot and update your DNS as a verification challenge. Change this to make sure it's two lines, and your domains and subdomains are correct and your paths are correct. sudo certbot certonly --manual --preferred-challenges=dns --email YOUR@EMAIL.COM --server https://acme-v02.api.letsencrypt.org/directory --agree-tos --manual-public-ip-logging-ok -d "azurefriday.com" -d "*.azurefriday.com" sudo openssl pkcs12 -export -out AzureFriday2023.pfx -inkey /etc/letsencrypt/live/azurefriday.com/privkey.pem -in /etc/letsencrypt/live/azurefriday.com/fullchain.pem I then copy the resulting file to my desktop (check your desktop path) so it's now in the Windows world. sudo cp AzureFriday2023.pfx /mnt/c/Users/Scott/OneDrive/Desktop Now from Windows, import the PFX, note the thumbprint and export that cert. Import-PfxCertificate -FilePath "AzureFriday2023.pfx" -