Invoke Azure Functions

Overview

The Invoke Azure Functions Action is used to execute an Azure FunctionApp Function.

This gives you the flexibility to handle specific requirements not covered by standard GorillaStack actions, allowing a customized automation solution within the platform. This powerful feature supports automating common business processes such as processing orders, sending notifications, or generating reports, triggering these functions from other workflows or applications.

It is secure and uses Azure Active Directory (Azure AD) to authenticate users and authorize actions.

Use of this action in a rule

As part of a sequence of Actions, you may wish to inject some custom code to handle a special requirement not already offered by GorillaStack.

When configuring this action you first specify your Azure Function by it's function name.

Next, you can specify a JSON Payload which will be included in the request body of the POST request to the function invokeUrlTemplate endpoint.

Important to Note

The Invoke Azure Functions action can invoke any FunctionApp Functions that satisfy all of these qualities:

  • Function is bound with an HTTP Trigger
  • Function has function scoped access keys
  • Function has been configured with an authLevel setting of function or anonymous

Action Configuration

Function Name

The name of the function that you wish to target with this Action.

JSON Payload

A JSON payload to be used in the request body.

e.g. Simple JSON Payload

{ "origin": "gorillastack", "targetService": "monitoring" }

Action Execution

GorillaStack invokes an Azure Function by making a POST request to it's invokeUrlTemplate endpoint.

Synchronous Invocation

Functions are invoked synchronously. It is worth noting that the absolute maximum response timeout for an Azure Function HTTP Trigger is 230 seconds.

By invoking Functions synchronously, the response status code of an invoked function influences a Rule's Action execution outcome.

This allows users to short circuit Rule execution and manage execution flow for sequences of Actions with complex interdependencies.

Access Keys

We do not require you to provide us with any access keys as part of your Rule configuration.

During action execution we make an API request to list a given function's access keys, using any available key as an auth token in a POST request to the function's invokeUrlTemplate endpoint.

Payload

When we make a POST request to the invokeUrlTemplate endpoint we provide a payload in the request body.

This Payload contains two properties:

  • azureFunctionActionPayload - Any JSON Payload from the Action configuration
  • ruleExecution - Rule Execution meta data

Notice this example Azure Function in JavaScript

module.exports = async function (context, req) {
  const { azureFunctionActionPayload, ruleExecution } = req.body;

  // your code here

  context.res = {
    status: 200,
    body: 'Great Success',
  };
};

We recommend checking out this specification for a schema of the JSON payload.