Utilizing WSL and Let’s Encrypt to create Azure App Service SSL Wildcard Certificates


There are numerous let’s encrypt computerized instruments for azure however I additionally wished to see if I may use certbot in wsl to generate a wildcard certificates for the azure Friday web site after which add the ensuing certificates to azure app service.

Azure app service in the end wants a selected format referred to as dot PFX that features the total certificates path and all intermediates.

Per the docs, App Service non-public certificates should meet the following requirements:

  • Exported as a password-protected PFX file, encrypted utilizing triple DES.
  • Incorporates non-public key a minimum of 2048 bits lengthy
  • Incorporates all intermediate certificates and the basis certificates within the certificates chain.

In case you have a PFX that does not meet all these necessities you possibly can have Home windows reencrypt the file.

I take advantage of WSL and certbot to create the cert, then I import/export in Home windows and add the ensuing PFX.

Inside WSL, set up certbot:

sudo apt replace
sudo apt set up python3 python3-venv libaugeas0
sudo python3 -m venv /choose/certbot/
sudo /choose/certbot/bin/pip set up --upgrade pip

Then I generate the cert. You may get a pleasant textual content UI from certbot and replace your DNS as a verification problem. Change this to verify it is two strains, and your domains and subdomains are right and your paths are right.

sudo certbot certonly --manual --preferred-challenges=dns --email YOUR@EMAIL.COM   
--agree-tos --manual-public-ip-logging-ok -d "" -d "*"
sudo openssl pkcs12 -export -out AzureFriday2023.pfx
-inkey /and so forth/letsencrypt/reside/
-in /and so forth/letsencrypt/reside/

I then copy the ensuing file to my desktop (verify your desktop path) so it is now within the Home windows world.

sudo cp AzureFriday2023.pfx /mnt/c/Customers/Scott/OneDrive/Desktop

Now from Home windows, import the PFX, word the thumbnail and export that cert.

Import-PfxCertificate -FilePath "AzureFriday2023.pfx" -CertStoreLocation Cert:LocalMachineMy 
-Password (ConvertTo-SecureString -String 'PASSWORDHERE' -AsPlainText -Power) -Exportable

Export-PfxCertificate -Cert Microsoft.PowerShell.SecurityCertificate::LocalMachineMy597THISISTHETHUMBNAILCF1157B8CEBB7CA1
-FilePath 'AzureFriday2023-fixed.pfx' -Password (ConvertTo-SecureString -String 'PASSWORDHERE' -AsPlainText -Power)

Then add the cert to the Certificates part of your App Service, beneath Convey Your Personal Cert.

Custom Domains in Azure App Service

Then beneath Customized Domains, click on Replace Binding and choose the brand new cert (with the newest expiration date).


Subsequent step is to make this much more computerized or choose a extra automated resolution however for now, I will fear about this in September and it solved my costly Wildcard Area problem.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, advisor, father, diabetic, and Microsoft worker. He’s a failed stand-up comedian, a cornrower, and a guide creator.

About   Newsletter

Internet hosting By
Hosted in an Azure App Service


Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button