Table of contents

Official Content

This document explains how to deploy a GeneXus application as Azure Functions.

Installing requirements

Install the requirements in the machine where you will run the deployment —you only need Azure CLI.

Setting up the cloud

The basic steps in the cloud are the following:

1. Create the resources in Azure. See HowTo: Create an Azure function app
2. To authenticate, configure a Service Principal.

Modeling in GeneXus

The basic steps in GeneXus are the following:

1. Create a Deployment Unit object and select the objects to deploy.

2. Use the Application Deployment tool to select the target "Microsoft Azure Functions." 
To deploy the backend services of an app, select the target "Microsoft Azure serverless (backend services)." In this case, the Functions are deployed as Http-triggered functions.

3. Configure the properties in the property grid.

4. Click the deployment button to deploy to Azure.

Functions Trigger type

Azure functions have Trigger Types (Trigger type property at the Deployment Unit). 

image_20211021153354_1_png

Depending on the trigger type of the functions, you have to consider different aspects when deploying.
To consider those aspects, you may group the functions that have a trigger other than Http, and those that have Http trigger.

Non-Http-triggered functions

For all the functions except those that have http trigger, consider the following to deploy the application.

This is an example of a timer triggered function:

image_20201210211228_1_png

Http-triggered functions

See Azure Http-triggered functions

Common aspects of functions

First, take into account that when the function is published on an existing function app, the function is updated.

Function settings

Depending on the function, it is preferable to be able to change some settings in the cloud. Those settings are configured at deployment time, and you can set the deployment engine to create an application setting in the cloud with the name and value you specify.

For example, for timer functions, you can specify a cron time, or an application setting (to be created in the cloud with the name and value that you wish).

image_2021317141342_1_png

For the last option, the advantage is that all changes can be made in the cloud (you don't need to deploy again for those changes).

image_2021128131135_1_png

The same happens with other function types like Queue or Service Bus, where the connection data is defined as an app setting.

Global configuration of functions

The behavior of all functions within the function app can be configured globally. This is done in the host.json file. For example, in that file, you can configure the trace level for the app, Health Monitor, etc.
Azure functions have a default timeout, which can also be changed at the host.json file.

Important: The GeneXus user has to manage this file.

The Application Deployment Tool uploads one with the basic settings, but if you want to use another, you can edit it and add it to the deployment unit (see Deployment of additional files and directories).

Sample host.json file to generate trace information:
{
    "version": "2.0",
    "logging": {
        "fileLoggingMode": "always",
        "logLevel": {
            "default": "Trace",
            "Host.Results": "Trace",
            "Function": "Trace",
            "Host.Aggregator": "Trace"
        },
        "applicationInsights": {
            "samplingExcludedTypes": "Request",
            "samplingSettings": {
                "isEnabled": true
            }
        }
    }
}

Architecture considerations

If the function app uses Image, Audio, Video, or BlobFile data types, you have to configure the Storage Provider property because all multimedia must be served from an external URL, such as Microsoft Azure.

For the same reason, it's not supported to use the file system to serve content; that is, to have read/write access to files (such as Blob data type, Excel, or PDF reports). 

For solutions using GAM, see HowTo: Use GAM in Azure serverless architecture.

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant