n3wt0n / AzureWebAppSSLManager

Acquires and manages free SSL certificates for Azure Web App and Azure Functions applications.
MIT License
76 stars 29 forks source link

Solution for functions timeout preventing all certificates being renewed #23

Closed thecontrarycat closed 4 years ago

thecontrarycat commented 4 years ago

When using Azure Functions on the Consumption Plan

By default, functions running with a Consumption Plan are terminated if they run for longer than five minutes. This can be extended to 10 minutes in the host.json, but for anyone who deployed via the ARM template this file is read-only.

When you have a large number of certificates to renew, it is likely that the function will be terminated before it can finish.

Solution

The solution for this problem is threefold:

  1. Configure the function to only request a new certificate if the existing one is due to expire soon (in 30 days by default, but configurable).
  2. Configure the function to exit once it has generated a certain number of certificates (batch size, defaults to 0/unlimited, but configurable).
  3. Schedule the function to run more frequently (once per day?) and allow this schedule to be configured.
n3wt0n commented 4 years ago

Thanks for this. Looks good