Currently (July 2017) the first 400,000 GB/s of execution and 1,000,000 executions are free. It is possible to use “armclient” to calculate the cost of running an Azure Function..
[armclient https://github.com/projectkudu/ARMClient can be installed using chocolatey]
PS C:\WINDOWS\system32>$apiVersion = "2016-06-01"
PS C:\WINDOWS\system32>$filter = "(name.value eq 'FunctionExecutionUnits') and timeGrain eq duration'PT1M' and startTime eq 2017-07-25T13:50:00Z and endTime eq 2017-07-25T13:55:00Z and (aggregationType eq 'Total')"
PS C:\WINDOWS\system32>armclient GET /subscriptions/YOURSUBSCRIPTION/resourcegroups/YOURRESOURCEGROUP/providers/Microsoft.Web/sites/APPSERVICENAME/providers/microsoft.insights/metrics?`$filter=${filter}"&"api-version=${apiVersion}
Execute the above (changing date parameters, subscription key etc) & it will return values in MB-miliseconds so you must divide by 1024000 to get GB/secs (according to this link)
The output is something similar to this:
{
"value": [
{
"data": [
{
"timeStamp": "2017-07-25T13:50:00Z",
"total": 0.0
},
{
"timeStamp": "2017-07-25T13:51:00Z",
"total": 132736.0
},
{
"timeStamp": "2017-07-25T13:52:00Z",
"total": 0.0
},
{
"timeStamp": "2017-07-25T13:53:00Z",
"total": 0.0
},
{
"timeStamp": "2017-07-25T13:54:00Z",
"total": 0.0
}
],
"id": "/subscriptions/XXXXXXX/resourcegroups/.../.../providers/Microsoft.Insights/metrics/FunctionExecutionUnits",
"name": {
"value": "FunctionExecutionUnits",
"localizedValue": "Function Execution Units"
},
"type": "Microsoft.Insights/metrics",
"unit": "0"
}
]
}
In this example the value would be:
132736 / 1024000 = 0.129 GB/s per execution (as the above results were for one execution)
The number of executions in 400000 GB/s = 400000 / 0.129 = 3 million approx. (But there is a cap of 1 million per month for free) Therefore, the function should be able to be invoked 1 million times per month for free (by my reckoning).
[