Shut down Azure functions when the free limit runs out

Jan Vacek 1 Reputation point
2022-08-11T15:09:11.24+00:00

Hello,

Is there a way to automatically shut down the Azure Functions server once the free limit runs out? I don't want to pay because this is just a test application.

Thank you!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,371 questions
Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,123 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. msrini-MSFT 9,261 Reputation points Microsoft Employee
    2022-08-14T06:22:55.567+00:00

    Hi,

    Azure Functions consumption plan is billed based on per-second resource consumption and executions. Consumption plan pricing includes a monthly free grant of 1 million requests and 4,00,000 GB-s of resource consumption per month per subscription in pay-as-you-go pricing across all function apps in that subscription.

    So, this 1 million request is for all your Azure Function app. So, there are metrics which are available to track the execution , so you need to write a script to capture that across all Azure function App and then check if that crosses > 4,00,000 GB-s.

    You can use this PowerShell sample:

    Get-AzMetric -ResourceId /subscriptions/<AZURE_SUBSCRIPTION_ID>/resourceGroups/metrics-testing-consumption/providers/Microsoft.Web/sites/metrics-testing-consumption -MetricName FunctionExecutionUnits,FunctionExecutionCount -AggregationType Total -TimeGrain 01:00:00 -StartTime 2019-09-11T21:46:00Z -EndTime 2019-09-11T23:18:00Z

    Reference : https://learn.microsoft.com/en-us/azure/azure-functions/functions-consumption-costs?tabs=azure-powershell

    Regards,
    Karthik Srinivas

    0 comments No comments