

Using WSL and Let's Encrypt to create Azure App Service SSL Wildcard Certificate...
source link: https://www.hanselman.com/blog/using-wsl-and-lets-encrypt-to-create-azure-app-service-ssl-wildcard-certificates
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Using WSL and Let's Encrypt to create Azure App Service SSL Wildcard Certificates
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 [email protected]
--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" -CertStoreLocation Cert:\LocalMachine\My -Password ( ConvertTo-SecureString -String 'PASSWORDHERE' -AsPlainText -Force ) -Exportable Export -PfxCertificate -Cert Microsoft.PowerShell.Security\Certificate::LocalMachine\My\597THISISTHETHUMBNAILCF1157B8CEBB7CA1 -FilePath 'AzureFriday2023-fixed.pfx' -Password ( ConvertTo-SecureString -String 'PASSWORDHERE' -AsPlainText -Force ) |
Then upload the cert to the Certificates section of your App Service, under Bring Your Own Cert.

Then under Custom Domains, click Update Binding and select the new cert (with the latest expiration date).

Next step is to make this even more automatic or select a more automated solution but for now, I'll worry about this in September and it solved my expensive Wildcard Domain issue.
Recommend
-
63
We’re pleased to announce that ACMEv2 and wildcard certificate support is live! With today’s new features we’re continuing to break down barriers for HTTPS adoption across the Web by making it even easier for every websi…
-
7
Tutorial How To Create Let's Encrypt Wildcard Certificates with Certbot Security
-
5
TIL: Wildcard SSL certificate does not support nested subdomains Aug 3 ・1 min read...
-
5
Use Let’s Encrypt Wildcard Certificates on OpenShift 4.x IngressIn Red Hat OpenShift Container Platform, Certificates are used to encrypt communications to the applications exposed using Routes/Ingress as well as Web Console access. When depl...
-
7
Getting a Wildcard SSL Certificate for Your Website at No Cost ...
-
7
Using a Different System? Let...
-
5
Using a Different System? Let...
-
7
Securing Your Filecloud Installation with a Wildcard Letsencrypt SSL Certificate
-
2
Wildcard Certificates with Traefik + cert-manager + Let's Encrypt in Kubernetes Tutorial By Techno Tim Posted 2 hours ago Updated...
-
5
Let's Encrypt Wildcard Certificates Made Easy with Agnos It is with great pleasure that we announce the first beta release of Agnos. A former personal pro...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK