azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Feature - Azure portal function app pause button

Open TroyWitthoeft opened this issue 2 years ago • 4 comments

What problem would the feature you're requesting solve? Please describe.

From within the Azure portal, I'd like to pause a function app for 30m, an hour, or maybe a few days. Azure Functions is missing a button like this ...

image Above: Added a pause button with a user selectable dropdown of some pre-determined time intervals.

Oftentimes organizations need to pause an Azure functions execution for a set period of time. For instance, say your azure function has an external dependency (API) it calls on each run. If that dependency is down, your function app fails. Now, say that we know is "down for maintenance" for several hours. The only current option we have for this is hard stopping the function and remembering to come back. Can we create a way where the function app is automatically re-enabled? Wouldn't it be more convenient if we could pause a function app for a set period of time?

I've thought some about how an Azure Function could wake itself from a pause. One thing to try would be having that pause button using the Azure management backplane. For instance, clicking the pause button would call that backplane api to STOP the function app.

STOP

POST https://management.azure.com/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/providers/Microsoft.Web/sites/<FunctionAppName>/stop?api-version=2015-08-01

Simultaneously, it would lodge a queue message in it's storage account to turn itself back on. Sa y ... creating a queue message with a START command that only becomes visible X minutes from now.

START

POST https://management.azure.com/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/providers/Microsoft.Web/sites/<FunctionAppName>/start?api-version=2015-08-01

This could work right? Every Azure Function can be started and stopped via the right url, and every azure function has a storage account with a queue where we could log START messages.

Describe alternatives you've considered

Using a Logic App = https://stackoverflow.com/a/54885118/2048857 C# specific [Disable()] method attribute = https://docs.microsoft.com/en-us/azure/azure-functions/disable-function?tabs=portal#c-class-libraries Note that this request is similar to feature request #7241 but without the explicit ask that azure functions gracefully wind down executions in flight. This ask is just for a scheduled stop and start after X minutes. Thanks!

TroyWitthoeft avatar Nov 24 '21 17:11 TroyWitthoeft

Thank you for your feedback! We will check for the possibilities internally and update you with the findings.

Ved2806 avatar Nov 30 '21 10:11 Ved2806

@Ved2806 Happy new year! I did see some other folks looking for a pause button as well.

Any feedback on making the "pause button" a feature of the azure portal?

TroyWitthoeft avatar Jan 05 '22 17:01 TroyWitthoeft

Still open? While I do believe that pausing a function app for a set period of time is a great feature request, It's also not an issue or bug. Feel free to close. Thanks everyone.

TroyWitthoeft avatar Dec 28 '23 04:12 TroyWitthoeft

Hello, similar request to pause Azure function for specific period of time in situation when there is internal call to 3rd party api which sometimes goes under maintenance and azure function throws exceptions. Thus whenever there is some exception like service not available need to pause Azure function from throwing same exception for all messages in queue, its better to pause Azure function and re-run after some configurable time

SwatiLiyaBasecone avatar Apr 28 '24 10:04 SwatiLiyaBasecone