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.

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

image_202212212918_1_png

API path

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

E.g: travel

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:

image_202212212138_1_png

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

image_2022122121529_1_png

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

image_2022122121731_1_png

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.

Then, at runtime, the /rest suffix in the URL is added automatically by the mobile clients to make the calls, as shown in the figure:

image_202212212338_1_png

GatewayURLAPIM

See also

For angular front end applications which use Azure serverless for deploying their backend, see How to: Angular front end applications using serverless backend