Manually trigger timer-triggered Azure Functions. Did you know?

2023, Jun 01

There is a way to manually trigger any timer-triggered Azure Functions via API request. It is an approach valid for all non-HTTP-triggered functions!

How to do it?

This can easily be accomplished in 3 steps:

  • Request location
  • Use the master key
  • Call the API

Request location

The request location is based on your Azure Function URL. From the regular endpoint:

https://your-function.azurewebsites.net/FunctionName

Make sure to use the folder path /admin/functions on the URL:

https://your-function.azurewebsites.net/admin/functions/FunctionName

Use the master key

Make sure to grab the master key, not the default key. This will be used with the header x-functions-key.

MasterKey

With a few clicks you can grab the Master Key from Azure Portal. This key should not be shared.

Call the API

Make sure to add the HTTP Headers: x-functions-key (with the master key) and Content-Type: application/json.

The body also needs to be provided, empty curly braces {} will do the trick.

PostRequest

PostRequestBody

Microsoft also uses this approach, as referenced here1