Azure Functions

Last Updated : Jun 12, 2024 |

Using the Azure Functions task, you can invoke the Microsoft Azure functions created in the Microsoft Azure environment to perform advanced customization of the workflow.

With the Azure Functions task, you can:

  • Create and configure API calls to Azure function

  • Process the response and declare new data to the workflow

  • Configure and create task outputs based on task results

  • Update information available in the workflow

You can use the Azure Functions task for scheduled data processing, Microsoft Azure service event-based processing, serverless web applications, or any other Microsoft Azure functionality. Apart from executing Microsoft Azure functions, with the Azure Functions task, you can rewrite the existing data in cache or downstream the workflow. Using the Azure Functions task, you can also update the predefined set of outputs based on the results that you receive.

Avaya Experience Platform™ Public Cloud supports Microsoft Azure functions only of the HTTP Trigger type. For authentication of OAuth 2.0 type, you can use only Microsoft as an identity provider. Before setting up the Azure Functions task in Orchestration, make sure that the function to which you refer is tested and published.

You can view the variables used in the evaluated conditions of the Azure Functions task for an instance from the Instances tab in Orchestration Manager. You can also view the current state of all the available variables.

This task is available to only Administrator users.

Properties

With the Azure Functions task, you can make requests to the Microsoft Azure portal and process the responses. You can use the Properties tab to create a request: choose a method, specify Functions URI, and identify header, body, and parameters. To configure a request, check the respective function on the Microsoft Azure portal.

Properties

Description

Method

HTTP verb that is used for the request. The currently supported verbs are the following:

  • GET

  • POST

  • PUT

Function URI

URI of the Microsoft Azure function consisting of protocol, function application name, route, and function name. The pattern is https://{function application}.azurewebsites.net/{route}/{function name}

For example, https://orchestrationfunctions.azurewebsites.net/api/HttpTriggerFunction

To set Function URI as a variable, click the Add Variable icon and select from the list of available options.

If you update or create a new certificate for a workflow, you must create the certificate with the full chain to prevent the workflow from failing and causing an outage.

Header

A list of key-value pairs that you add to the request as headers. By default, Orchestration uses the header key Content-Type.

No user input is required if you use the default key. When you change the body type, the content type in the header changes automatically.

To set Header as a variable, click the Add Variable icon and select from the list of available options.

Body

Body of your request in the following format:

  • Text

    A multiline body type.

  • Json

    A multiline body type. Default body type.

  • Multipart

    A body type represented as a key-value pair.

  • Urlencoded

    A body type represented as a key-value pair.

You can use variables in all body formats. To add a variable, click the Add Variable icon and select from the list of available options.

Param

A list of key-value pairs that you add to the request as query parameters. You can use variables as query parameter values.

To set a query parameter as a variable, click the Add Variable icon and select from the list of available options.

Configuration

Properties

Description

Request Timeout (sec)

The request timeout in seconds after the expiry of which the request fails with an error. The default value is 5 seconds. The maximum value is 200 seconds.

Socket Timeout (sec)

The WebSocket timeout in seconds after the expiry of which the request fails with an error. The default value is 5 seconds. The maximum value is 300 seconds.

Authentication Settings

Orchestration supports the following authentication settings:

Authentication Settings

Description

Enable Function Access Key

Used for non-anonymous Microsoft Azure functions.

OAuth Authorisation

Used for functions with Microsoft as an identity provider.

The Azure Functions task supports the following grant types:

  • Client credentials

  • Password credentials

You can use one of the methods, their combination, or none, depending on function settings.

Ensure that the authentication settings in Orchestration match those of the respective function on the Microsoft Azure portal.

Response Schema

With a response schema, you can declare the properties you receive during an API call and make them available to the subsequent tasks. To set up tasks in the workflow, in Orchestration, you can use a set of predefined properties available to the workflow. However, the Azure Functions task is not limited to such a predefined set, as you can get any required information from endpoints. To provide Orchestration with additional information, use response schemas. This information can include the data you expect to receive and properties that Orchestration can use later in the workflow. Using response schemas, you can enlarge the list of properties for the result mapping in the same Azure Functions task and the subsequent tasks.

In Orchestration, you can use schemas for success and error responses. You can take the schema from the API documentation of the REST endpoint, generate it with the dedicated software, or use the JSON Schema Editor in Orchestration. To open JSON Schema Editor, click View JSON Schema.

Orchestration can use the declared properties with those collected earlier in the workflow for effective routing decisions.

Result Mapping

With result mapping, you can manipulate the data available in the workflow: add new data to the cache, rewrite the existing cache data, or change downstream task properties. As data, you can use cache variables or results of the current and previous tasks.

To map the results with the places to store or use this data, fill in the following fields:

Field

Description

Destination

The destination point where you save data. You can save data in subsequent tasks as properties or in the cache as cache variables.

To specify the required destination, click the Destination field and select the variable:

  • Cache Variables

  • Task Properties

To create a new cache variable, type a new variable name in Type Custom variable and click the Add Variable icon.

Value

The value that you pass to the destination point. As a value, you can use any data available to the workflow:

  • Cache Variables

  • Global Variables

  • Result Variables

  • Current task Variables

To add a value, click the Add Variable icon and select from the list of available options.

For example, you can use result mapping to replace the existing attribute list with the list received from a Microsoft Azure function.

You can define the mapping for the following results:

  • error

  • success

  • Successful request but unable to parse response

To each result section, you can add multiple result mappings.

Outputs

Using outputs, you can configure a workflow based on results that you receive during the Azure Functions task. By default, all Azure Functions tasks have success and error outputs. You can edit default outputs and create customized outputs based on required conditions or timeout values. When creating a new output, click Add Output and fill in the following fields:

Field

Description

Output Label

The unique output name that you can see in the list of task outputs. You can connect this output with the next task in the workflow.

Choose output condition

Output conditions based on logic or timeout values. You can choose the following:

  • Add Logic

    In the Add Conditional Logic field, type the conditional expression that triggers the output.

    To use a variable in your expression, click the field and select the required variable from the list.

    For example, data.response.status=='success', where data.response.status is the current task variable.

  • Add Timer

    In the Timeout field, you type the required timeout value in seconds, minutes, or hours. When the timeout expires, the task ends with the configured output, and the workflow continues. You can use the timeout to terminate the task if Orchestration receives no answer from the endpoint.

To change the order of outputs, click Reordering icon and drag the output to the required position. Orchestration checks configured conditions in a descending order. When one of the conditions is met, Orchestration does not check the subsequent conditions. Order the conditions considering their priority.

Target tasks

Target tasks are tasks located downstream the workflow. The Azure Functions task does not have fixed target tasks for its outputs. You can put the Azure Functions task anywhere in the workflow and connect it with any task.

Output

Description

Target task

Success

Orchestration received a success response from the Microsoft Azure function.

Any task

Error

An error occurred during the task execution.

You can handle the interaction with the Error Handler task or proceed with the workflow as if Orchestration did not perform a REST call.

Any task

Customized output

Function depends on configuration of the customized output on the Outputs tab.

Any task