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:
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).
Configure the function to exit once it has generated a certain number of certificates (batch size, defaults to 0/unlimited, but configurable).
Schedule the function to run more frequently (once per day?) and allow this schedule to be configured.
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: