Easy automation of Let's Encrypt for Azure App Service (Web Apps / Functions)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Azure App Service Let's Encrypt

Build status

This function provide easy automation of Let's Encrypt for Azure App Service. This project started to solve some problems.

  • Support multiple app services
  • Simple deployment and configuration
  • Robustness of implementation
  • Easy monitoring (Application Insights)

They can manage multiple App Service certificates with simple one Functions.

Table Of Contents

Feature Support

  • Azure Web Apps and Azure Functions (Windows)
  • Azure Web Apps (Linux) / Web App for Containers (required Azure DNS)
  • Subject Alternative Names certificates (multi domains)
  • Wildcard certificates (required Azure DNS)
  • Multiple App Service with one Functions


  • Azure Subscription
  • App Service with added hostnames
  • Email address (for Let's Encrypt account)

Getting Started

1. Deploy to Azure Functions

2. Add application settings key

  • LetsEncrypt:SubscriptionId
    • Azure Subscription Id
  • LetsEncrypt:Contacts
    • Email address for Let's Encrypt account

3. Assign roles to target resource group

Using Access control (IAM), assign a role to Function App. Require "Website Contributor" and "Web Plan Contributor" role.

Assign a role

IAM settings


If the Web App refers to a Service Plan in a different resource group, Please assign "Website Contributor" role for Resource Group with Web App and "Web Plan Contributor" role for Resource Group with Service Plan.


Adding new certificate

Run AddCertificate_HttpStart function with parameters.

curl https://YOUR-FUNCTIONS.azurewebsites.net/api/AddCertificate_HttpStart?code=YOUR-FUNCTION-SECRET -X POST \
    -H 'Content-Type:application/json' \
    -d '{"ResourceGroupName":"My-WebApp-RG","SiteName":"my-webapp","Domains":["example.com"],"UseIpBasedSsl":false}'
  • ResourceGroupName
    • Resource group containing App Service. (ex. My-WebApp-RG)
  • SiteName
    • App Service name to issue certificate. (ex. my-webapp)
  • Domains
    • Hostnames to issue certificate. It needs to be added to App Service. (ex. example.com)
  • UseIpBasedSsl
    • Use IP Based SSL binding. (boolean, optional)

Renew certificates

This function will check the expiration date once a day for the certificate issuer is "Let's Encrypt Authority X3" or "Let's Encrypt Authority X4".

The default time is UTC 00:00, so if necessary they can set any time zone with WEBSITE_TIME_ZONE.

Deploy new version

This function use Run From Package. To deploy the latest version, just restart Azure Functions.

Wildcard and Linux Container support

If they need a Wildcard certificate, additional assign "DNS Zone Contributor" role to Azure DNS or Resource group.

IAM settings

Certificates for "App Service on Linux" and "Web App for Container" is required Azure DNS.

Known Issues

Causes Azure REST API error at GetSite or Dns01Precondition

Make sure that the required role is assign for the resource group. Azure IAM may take up to 30 minutes to be reflected.



This project is licensed under the Apache License 2.0