Usage data is available through the Azure Monitor REST API. For general information on using this API, see here .
Corresponding FunctionExecutionUnits
metric. This device is in MB milliseconds, so to convert it to GB seconds you need to divide the values by 1,024,000. The following is an example of a request for receiving minute usage data for an application function:
GET /subscriptions/<subid>/resourcegroups/<rg>/providers/Microsoft.Web/sites/<appname>/providers/microsoft.insights/metrics?api-version=2016-06-01&$filter=(name.value eq 'FunctionExecutionUnits') and timeGrain eq duration'PT1M' and startTime eq 2016-12-10T00:00:00Z and endTime eq 2016-12-10T00:05:00Z and (aggregationType eq 'Total')
You will return something like this:
{ "value": [ { "data": [ { "timeStamp": "2016-12-10T00:00:00Z", "total": 0 }, { "timeStamp": "2016-12-10T00:01:00Z", "total": 140544 }, { "timeStamp": "2016-12-10T00:02:00Z", "total": 0 }, { "timeStamp": "2016-12-10T00:03:00Z", "total": 0 }, { "timeStamp": "2016-12-10T00:04:00Z", "total": 0 } ], "name": { "value": "FunctionExecutionUnits", "localizedValue": "Function Execution Units" }, "type": "Microsoft.Insights/metrics", "unit": "0" } ] }
source share