Deploy mobile services to Azure Serverless using API Management

Official Content
This documentation is valid for:

When deploying mobile app services to an Azure Serverless architecture, you use the "Microsoft Azure Serverless (backend services)" deployment target.

This document explains details about the deployment to Azure API Management (APIM), which is optional.

First, note that you have to set the Generate OpenAPI interface property to Yes and OpenAPI version property to either 2.0 or 3.0, and do a rebuild all in the model, previous to deploying to Azure Serverless.

The following error is shown if the property is no set:

"Error: All the objects of the Deployment unit must have Generate OpenAPI Interface property set to Yes.  Alternatevely, set to Yes the property at the generator level, and do a rebuild all."

Before going on, read Azure Http-triggered functions.

To deploy to APIM, you need to configure the following deployment properties:

APIM service name

Name of the API Management service instance.

APIM resource group

Azure API Management resource group.

API Identification

API revision identifier. It must be unique in the current API Management service instance.

API display name

Display name of this API.

API backend service URL

Absolute URL of the backend service implementing this API. 

It corresponds to the URL given for the Azure function app, plus "/rest":

E.g: https://MyFunctionApp.azurewebsites.net/rest

URLFunctionApp

API path

Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance.

E.g: Clients

API subscription required

If true, the API requires a subscription key on requests. The recommended value for services being called from mobile clients is False.

Example

Consider the following deployment configuration:

deploytoAPIM

With the above settings, the API can be seen as follows in the Azure portal:

APIMAPIView

To run the app and use the services just deployed, configure the Services URL property as follows:

ServicesURLAPIM

Note that the URL is the Gateway URL shown in the Azure portal for the APIM service, followed by the API path you configured on deployment (the /rest suffix in the URL is added automatically to make the calls).

GatewayURLAPIM

Angular applications

In the case of Angular applications, you have to configure the CORS.

Go through the API inbound policies on the Azure portal, and configure the CORS Allow Origin policy for the machine where the Angular app is running.

CORSAPIMConf

For more information on this topic, read the Azure documentation.

Availability

APIM support is available since GeneXus 17 upgrade 7.