Azure API Management(APIM) for Power Platform

Hi Folks,

In today’s world, all the modern software applications use API for the front end to communicate with the backend systems, so lets see as it is very important for every developer working on Azure and API’s. Basically this is a PAAS Service from Azure. Follow along if you would like to know more details on this.

In short APIIM is a hybrid and multi cloud platform used to manage complete API life cycle. Azure API Management is made up of an API gateway, a management plane, and a developer portal.

  • Caching response to improve performance
  • Limit the number of API Calls
  • Security API and providing access
  • Interface to test API calls
  • API Analytics
  • Package related API Services
  • Transforms your API’s without
  • API Gateway is the first point of contact for any requests for your API which will route your requests to the appropriate backends. Imposes additional security restrictions with the help of JWT tokens and other certificates. Responses can be cached so that the API response could be faster.
  • Emits logs, metrics, and traces for monitoring, reporting, and troubleshooting
  • API Management are highly configurable, with control over URL mapping, query and path parameters, request and response content, and operation response caching.
  • Groups helps to provide conditional viewing capabilities.
  • Policy can help to change the behavior of an API without any code changes, this is well suited for your production API’s.

Also its easy to integrate API Management with all the other Azure Service available in the market.

Now lets go into the hands on by creating an APIIM simply from Azure.

Go to Home – Microsoft Azure and search for APIIM and select API Management services and click on Create.

Input all the details, it was pretty self explanatory, coming to the pricing tier you could select based on your project needs and use case. Click on Review and Create and then Create.

It will take few minutes for the deployment to complete and you can use it.

The below Power point slide presentation is complete resource which can help you with all your queries related to Azure API Management.

Grand Tour of Azure API Management

I hope this gives you a bit of introduction to Azure API Management, now lets see how you can use this in your Power Platform Solutions.

For this, once your API ready, all you have do is to export your API’s from Azure API Management to your Power Platform Environment. With this the citizen developers can unleash the capabilities of Azure where the API’s are developed by professional developers. With this capability, citizen developers can use the Power Platform to create and distribute apps that are based on internal and external APIs managed by API Management.

Steps to follow would be as below:

All you need to do is to create a custom connector for your API which can be used in Power Platform like Power Apps, Power Automate etc.

  1. Navigate to your API Management service in the Azure portal.
  2. In the menu, under APIs, select Power Platform.
  3. Select Create a connector.
  4. In the Create a connector window, do the following:
    1. Select an API to publish to the Power Platform.
    2. Select a Power Platform environment to publish the API to.
    3. Enter a display name, which will be used as the name of the custom connector.
    4. Optionally, if the API doesn’t already require a subscription, select Create subscription key connection parameter.
    5. Optionally, if the API is protected by an OAuth 2.0 server, provide details including Client IDClient secretAuthorization URLToken URL, and Refresh URL.
  5. Select Create.

Once the connector is created, navigate to your Power Apps or Power Automate environment. You will see the API listed under Data > Custom Connectors.

Custom connector in Power Platform

I hope this will give you a complete picture about API Management in Azure…if you have any further queries, don’t hesitate to comment here…

Cheers,

PMDY

Azure function – Dynamics CE integration guide

Hi Folks,

In this blog post, we will talk about the integration of Dynamics CE first party apps(Model driven) with Azure.

You can integrate with Function Apps from Dynamics using two ways…

  1. Authenticate your Dynamics CE app within your Function app code
  2. Register a web hook to trigger a call to Azure functions using a trigger

We’ll see both the scenarios…

  1. Authenticate your Dynamics CE app within your Function app code

Open your favorite IDE and create azure function..in this case I’ll be using Visual studio.

Create a new Azure Function Project(Make sure you install the Azure functions project template using extensions).

Click on Next option at the bottom, in the next step specify your Function App name as below.

Don’t change other values and click on Create at the bottom of the page.

So in the next step, please make a note of the important things which were highlighted below..

Make sure you select the Target framework as .Net Framework.

You can select any trigger, but for simplicity I am selecting HTTP Trigger here.

In case you need to debug your Azure function and run it locally, then you need to be sure that you install Azurite Storage Emulator in your machine using this link, otherwise you can select None for the storage account option, if in that case make sure that your Azure function don’t need any storage.

Don’t change other values and click on Create at the bottom of the page.

This will take couple of mins to create the necessary scaffolding required for the Azure function.

Now you need to authenticate to your Dynamics Instance, so firstly right click on your project and select Manage Nuget Packages. Then you need to browse for Microsoft.Crm.Sdk.CoreAssemblies and install.

Then you will be able to authenticate your Azure function with Dynamics CE…once you were authenticated you can create a hard coded entity record in Dynamics whenever your function app runs.

The entire code…is hosted in GitHub for reference.

In this way you can an integration between Azure function and Dynamics 365

We will require the API testing tool, here I am using Postman and the following is the link to download “Postman”. https://www.postman.com/downloads/

To test the application, click on the Start button on top of Navbar as mentioned below in the screenshot [Button will have Project Name]. It will take a few minutes to Load the Azure Emulator

Run the Function App on the Local machine for testing.

Following is the screen you will be able to see and copy the URL highlighted in the red below and paste that URL in Postman.

Azure Function Tool

Open the Postman and click on the create a new tab

Postman Dashboard

Select request as POST and paste the URL:

After pasting the URL, click on Send

You will get the following response on the Azure Function Tool and Postman

The result after Sending Post Request to Azure Function

If there any error or issue with the Azure Function code, the request will be failed and will be displayed on both Azure Function Tool and Postman [Status will be “4**” or “5**” ]

Now, we will take look at Dynamics 365 CRM environment and check whether the account is created or not.

Result

Created customer from Azure Function.

2. Register a web hook to trigger a call to Azure functions using a trigger

Will update the post to add this logic next time.

Cheers,

PMDY