Creating a custom connector to On-Premise Data Source for PowerApps & Flows

How to Create a custom connector for PowerApps and Flows.

Let’s review the prerequisites needed to create a custom connector.

  1. A Web API solution which is hosted on your local IIS machine with access to the web API through the domain api.contoso.com
  2. An app registered in azure app registrations (https://portal.azure.com) with a Client ID and Client Secret configured in web API solution (More Info: Refer) These details will be used in creating the custom connector
  3. Register another app in Azure AD similar to the details above. Copy the Client ID and Client secret of this app

Creating a custom connector for PowerApps and Flows

Open the PowerApps web app in Office 365

Select Data, then choose Custom Connectors

Select the Create custom connector button and then choose on Create from blank from the dropdown (Fig.1)

  Figure 1: Creating a custom connector

Provide a meaningful Custom Connector Name (Fig.2)

Note: I’ve given it as Custom Web API Connector

 

Figure 2: Naming the custom connector

  • Select Continue
  • Select the General tab and fill in the details of the form

    Figure 3: Fill in the general information

  • Ensure the Host is pointed to the desired web API endpoint

Navigate to Security tab and fill in the details (Fig.4):

  • Select OAuth 2.0 as the authentication type
  • Select Identity Provider as Azure Active directory
  • Paste the Client Id and Client Secret which were copied earlier (Mentioned as a prerequisite)
  • Keep the Login URL as it is
  • Enter Tenant ID and Resource URL
  • Enter Scope as User.Read

Figure 4: Setting up security for the custom connector

Note: Ensure the APP URI property for Custom Web API azure app in Azure portal is entered for the Resource URL field

Navigate to Definition tab:

Click on + New Action

In the General form (Fig.5)

Write a Summary

Write the description of an Action

Enter Operation ID which is unique for all actions

Figure 5: Updating the General form

Enter Request information: (Fig.6&7)

  • Click + Import from Sample
  • Choose a Verb (I chose GET)
  • Enter API URL (ex: /api/Employee)
  • Pass the Headers (optional) and select Import

    Figure 6: Defining pre-requirements needed in order to make a request

    Figure 7: Importing information from a sample

Go to Response section: (Fig.8)

  • Select + Add default Response
  • Enter Actual data which was in the Body section and select Import
  • Once importing is completed, specifying each property name can be done in the response section

    Figure 8: Defining the response returned by the underlying connector

Select Update Connector: (Fig.9)

Figure 9: Updating the connector

Navigate to Test tab (Fig.10)

  • Select + New Connection and choose Create button
  • Enter credentials to create the connection

    Figure 10: Creating a new connection to test the connector

New Connection will be created in the connection list

Go back to Custom Connector and select Edit

Navigate to Test tab and Select the Connection from the drop down

Choose Test operation on Get Employee tab (Fig.11)

Figure 11: Testing the custom connector

The test result is shown in Fig.12

Figure 12: Test result of custom connector which is created

Conclusion:

To run through, I have to say that the custom connector is created, and the data is accessible through the actions specified. Custom logic or expressions can be added and consumed as data validations as a service used to connect PowerApps & Microsoft Flow. This will help your business to improve the security and access any local data sources with this approach.

Note: When creating the custom connector. GET, POST, PATCH, PUT, DELETE requests can also be configured through the connector where they can be used in both PowerApps and Flows to manipulate with on-premises data with the help of custom WebAPI.

 

Refer Links:

https://docs.microsoft.com/en-us/connectors/custom-connectors/define-blank

Related posts