Jul 27, 2026

Publish APIs in Azure API Management

We have seen how to commission and API Management service, Portal and check OOB API. Lets see how we can add our own API to the service and access it as a end user.

I found https://petstore3.swagger.io/api/v3/openapi.json as a good one to try out.

Now I go to API and add as a OpenAPI.


Now I provide the OpenAPI specification which is the above URI of API. Also I gave suffix which is being added to the base url as below.


1. Test within Azure API Management

Now we can see newly added API along with its operations.

In order to test, I selected a operation (i.e Find Pet By Id) and passed 10 as the Id. Once click send I got 200 OK aling with response back. NowI know this is working.

2. Access via Developer Portal

Now go to Products and click Add to create new product. (Alternatively you can add this API to existing Producs to have common subscription. Eveybody subscribed to that product will get access to the new API as well)


Once Add it you will see it in the Product list as a Published Product.


Now browse the Portal and login as a end user. Then you will see this product which end user need to subscribe. Once done, end user will see active entry for this under Profile.


Now user can go to API tab and test the API by clicking the API, select a operation and select Try this Operation and passing any parameters.


2. Discussion

At the time of testing the API in Azure, we could see a url called Request URL as below. (Will call A) This URL has a prefix added by us during configurig the API. 
https://apimrnsume2.azure-api.net/DummyPetstore/pet/{petId}

At the Design tab of the API we could see a url called Backend URL as below. (Will Call B)
https://petstore3.swagger.io/api/v3

If we add correct Parameters (https://apimrnsume2.azure-api.net/DummyPetstore/pet/10) and try browsing A in a new Browser, it will not work. If we modify B the same way (https://petstore3.swagger.io/api/v3/pet/10) and browse it will return values.

This explains that we have added extra security layer to the APIs we publish via Azure API Management service. Backned one was freely browseable since its a public API without security. 

By any chance, we need to make our API to be freely available we can simply go to Settings of the API and clear the Subscription Required flag,


Related Reads:

References:

Jul 26, 2026

Comissioning Azure API Management Service

Azure API management is a comprehensive solution to add intermediate layer to handle all you APIs from one single point. Below is a well described illustration on main components. 


First of all we will see how to create a API management service and how it will be presented to end users via its Portal. In this example we will not add a new API but use in built sample for explanation porpose. 

1. Create Azure API management service

I am creating a new API Management Service by providing Subscription, Resource Group etc
    

Once hit the Create button it could take bit of time to complete the creation process. Once created we can see the Portal URL within many details presended in Overview.


Also notice that, upon create, we have already a sample API created which we can use to play around.


2. Developer Portal: Administration

By clicking Developer Portal link we will get the Portal opned in a different tab in Administrative Mode. 


This allows us to change design and contents as we wish. Then Save and Publish.


Alternatively you can publish the Portal by clicking Publish under Portal overview. (It is also advisable to Enable CORS)


3. Portal: Enble for end user

To view the end user experiance, you need to open the Portal in InProvate browser.
If you dont publish the Portal as per one of the ways explaind in previous step, Portal will not be visible. Below error will be shown.


Assuming you are a new user, now can be sign up (use a different email than your admin one already in the system as the Administrator)



This will also send you a email to verify before proceeding.

Alternatively, you can add users from Users under Developer Portal.


Now you are able to login as a end user.

4. Developer Portal: End user access to API
Once logged in as the end user, browse to Products menu item to enable subscriptions.


Give a name and request subscription for each.
After that, under profile I can see Starter is Active but Unlimited is still in Sumbitted status.


Now from Azure side, go to API Management Service, APIs, Subscription then select the subscripion which is not active yet and make it Active.


If you go back to Portal you will now see as both Subscriptions Active. Lets go to API and click the our of Box API we have just got the subscriptions activated.


Click it and click Try this Operation for any method. I selected Retrieve resource. Resulted popup will allow you to select the subscription too. Click Send.


Now we are getting the expected 200 OK response back, meaning we are executint it correctly and getting a respose back.


End user is now good to use the API.

Related reads: 

References:

Jul 15, 2026

Create Azure Logic Apps using Visual Studio Code

We usualy create Azure Logic Apps in Azure portal with all the drag and drop help. Still we can do it in Visual Studio Code which gives many benifits such as more control, testing, source controlling etc. Lets see how to achieve it step by step. 

1) Preparation of Visual Studio Code environement

Before starting, make sure we have below Extensions installed in Visual Studio Code.

(Note: Visual Studio Code may take bit more time to validate and enable extensions. If your expected menu/ command is not available, may be you need to give bit of time.)


2) Create Logic App 

Go to Workspace under azure and select Create new logic app workspace.


Then project will alow you to provide path name and below details.

Its important to select below settings for this excersise. (Logic App type = Logic App (standerd) and Workflow Type = Stateful)


You may see below project is now created and folder structure as below.

Now Convert Logic App to NuGet based logic app project.


Now Open workflow.json file in designer.


Here you will need to select Use connecters from Azure option, Resource Group etc.

Now you are good to create a simple Logic App for testing purpose with familiar components. Here I have added below actions. Added sample json to Compose component and modified Response component to read output of Compose component.


This may also ask you to login to your Azure subscription.

3) Test locally

Now go to Run in editor and start Run / Debug.


After run right click workflow.json and select Overview to get the URL as below.

Now try this url in Postman to see the result which is the sample json we passed.


Also its possible to click Run History and get visual execution session diagram as normal Logic App. (this looks same for Power Automates too)

4) Publish in Azure

If satisfied with testing, its time to deploy. Select Deploy to Logic app from the menu appear when right click the logicApp.


It will also ask few settings on Publishing in Azure and most of them are self-explanatory.

Once done, you will see newly deployed Logic App in Azure Portal.

5) Test Published App

Now, under workflow, you will see new workflow we designed with sample json, ready to be run.

Run will show us the json as the Response Body which is a proof our logic app is running successfully.



(Ref: https://www.youtube.com/watch?v=ZOeTtgifIP4&t=306s)

Jul 10, 2026

Call Azure Function directly from Plugin

This is step by step guide to explain how to call an Azure Function directly from a Plugin. When I say diretly, we do it in the code level. Other way of doing it is via  webhook. Lets jump in.

Scenario

When we create a Contact in Dataverse (model-driven app), I need to register the contact in the financial system which is best done using an Azure Function. So Approach is I am writing a pre create plugin for Contact which should call Azure Function to get the registration done. For this I am passing Contacts' full name to the function and expecting registration numbers to be passed back to Dataverse.

Create Azure Function

(Refer: https://www.youtube.com/watch?v=NhhmLt0YGqY&t=218s for step by step create of function app)

Here I retrieve name and returning registered number back. (Registering logic is not implemented but to ocestrate the action I am generating a randon number as registration number)

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;

namespace Sume4FunctionApp;

public class SumeFunction1
{
    private readonly ILogger<SumeFunction1> _logger;

    public SumeFunction1(ILogger<SumeFunction1> logger)
    {
        _logger = logger;
    }

    [Function("SumeFunction1")]
    public IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequest req)
    {
        // Retrieve Value
        string name = req.Query["name"];
        _logger.LogInformation($"Azure Function retrieved: {name}");

        // Logic
        // TODO - Register name in Financial System
        string FSID = Guid.NewGuid().ToString("N")[..10];

        // Retern Reg Number 
        return new OkObjectResult(FSID);
    }
}

After local testing, publish the Azure Function in Azure.


Now you can see the Azure Function under Function App.


Under Function Keys, you can retrieve the code which will be used in Plugin code.


Create Plugin

Now its time to call the Azure Function from Plugin code. Plugin is registered in Pre Create with below settings.


Notice how I compile the full name to be passed to function. Also how I retrieve the registration number and set to relevant field which will be populated (since we are in pre-stage just assigning is enough). Notice below steps;

  • We create a class with contact name as attribute to be passed to serializer
  • Serviceurl consist of below 3 components
    • Site Address (from Azure registration of Function App)
    • Function name (As we know from the code)
    • Code (read from function)
(Refer https://www.youtube.com/watch?v=KdGZ2Oo-4L8 to get explanation of steps)

if (execCtx.InputParameters.Contains("Target") && execCtx.InputParameters["Target"] is Entity target 
    && target.LogicalName == "contact")
{
    // Retrieve Name
    var contactDetail = new ContactDetail();
    string firstName = target.Contains("firstname") ? target.GetAttributeValue<string>("firstname") : string.Empty;
    string lastName = target.Contains("lastname") ? target.GetAttributeValue<string>("lastname") : string.Empty;
    ctx.Trace($"Contact Created - First Name: {firstName}, Last Name: {lastName}");
    contactDetail.name = firstName + " " + lastName;

    // Call Azure Function and Pass Contact Name
    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ContactDetail));
    MemoryStream memoryStream = new MemoryStream();
    serializer.WriteObject(memoryStream, contactDetail);
    var jsonObject = Encoding.Default.GetString(memoryStream.ToArray());
    var webClient = new WebClient();
    webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
    var code = "eAy22Izpd6kF5VTNHyArUu-I86MkbpVWOJYG9k8M-3L1AzFuGBtDxA==";
    var serviceUrl = "https://sume4functionapp.azurewebsites.net/api/SumeFunction1?code=" + code;
    string response = webClient.UploadString(serviceUrl, jsonObject);

    // Set the retrurned value (Financial system bymber) back to Contact record
    ctx.Trace($"response {response}");
    if (response != null)
        target.Attributes["so_financialsystemid"] = response;
    else
        throw new InvalidPluginExecutionException("Failed registering to FS via Azure Fuction");
}
        public class ContactDetail
        {
            public string name { get; set; }
        }

How it works

Now create Contacts and see how Financial System Id is being populated.


We can monitor this in two places of Azure.

1) Under Invocation of Azure Function as below.     


2) Under Log Stream of Function App. 


This is just a simple example, but hope this gives idea on what needs to do in each component and the sequance.