Create a Custom Connector for your Web API from within Visual Studio

Hi Folks,

In this blog post, let’s see how we can create a custom connector without leaving our own Visual Studio for building a custom connector. Ideally for building any custom connector, we need to create them in https://make.powerapps.com or https://make.powerautomate.com. Last month Microsoft Announced that Power Platform is now a connected service in Visual Studio 2022. In this blog, we will utilize its capability…

Before diving deeper, let’s see what are the prerequisites..

  1. Visual Studio
  2. ASP .NET Web API knowledge
  3. Canvas Apps knowledge

Let’s get started..

Step 1:

Create ASP.NET Web API Project in Visual Studio

Step 2:Choose your option as below and click on Next..

Step 3:

Choose your next steps as below and click on Next to proceed, make sure to choose authentication type as None

Step 4:

Create a ASP.NET Core Web API Project

Step 5:

By adding Power Platform as a service dependency, you can update an existing custom connector, or create a new one from your API.

If you want to expose your local running API to a public endpoint, I prefer using Dev Tunnels feature of Visual Studio…

That’s it, you have started running your API.

Step 6:

Now let’s create a Mobile App with Power Apps…with the same login you have used for the Visual Studio to create a custom connector..

Step 7:

First check if Custom Connector has been created in your tenant and authenticate the connection….navigate to https://make.powerapps.com and click on Discover at the left of the page….and then click on Custom Connectors, you should see a connector which we created from Visual Studio….nice isn’t it…

Step 8:

All you need to create a connection by clicking on the + sign available..

Once connected, now try creating a mobile Canvas App..

In the Canvas App, try adding data…and search for Weather Sample which you created, you should see something like below…

Step 9:

Once the web API is running in your development environment, you can debug in real time and even Hot Reload your code.

References:

https://learn.microsoft.com/en-us/aspnet/core/test/dev-tunnels?view=aspnetcore-7.0#create-a-tunnel

Thank you for reading…

Cheers,

PMDY

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