API Management - Hands-on Lab Script

Home

Additional Topics - API Proxy to Serverless

Azure Serverless (Functions and Logic Apps) can be configured to benefit from the advantages of API Management.

Azure Functions

Example:

    //string[] strColors = { "blue", "lightblue", "darkblue" };
    string[] strColors = { "green", "lightgreen", "darkgreen" };

    Random r = new Random();
    int rInt = r.Next(strColors.Length);

    return  (ActionResult)new OkObjectResult(strColors[rInt]);

Lets add the function to API Management. In the API blade select [+Add API] and the [Function App] tile

Azure Logic Apps

Example:

Use the following sample message to generate the schema of the Request body payload. By specifying the schema, the individual fields (in this case msg) can be extracted and referred to in the subsequent logic

{
  "msg": "text"
}

Lets add the function to API Managament. In the API blade select [+Add API] and the [Logic App] tile

As previously add CORS policy


Home