Power Platform Custom Connector

Power Platform Custom Connector

Azure Logic Apps, Microsoft Power Automate, and Power Apps offer access to over 1,000 built-in connectors that let you easily connect to Microsoft services and third-party platforms. However, if you need to integrate with a service that doesn’t have a connector available, custom connectors let you build your own. These custom connectors can include personalized triggers and actions, and can also be shared with others giving you the flexibility to connect to almost any API

Key Features:

  • Connect to external services/APIs not covered by existing connectors.

  • Define requests, responses, authentication (OAuth 2.0, API key, etc.).

  • Build connectors using: OpenAPI definition , Postman Collection ,import Github, create from azure services and From blank via UI

How To Create a Custom Connector

Option 1: From Power Apps

Navigate to Power AppsCreateAutomationCustom Connector

Option 2: From Power Automate

Go to Power AutomateDataCustom Connectors+ New Custom Connector

Steps To Create Custom Connector

Start from blank OR

Import an OpenAPI file, Postman collection, or other supported formats.

Lets first start with blank then import postman collection

1) Update general details

On the General tab,

  • Upload connector icon

  • In the Description field, enter a meaningful value. This description appears in the custom connector's details, and it can help others decide whether the connector might be useful to them.

  • Update the Host field to the address for the Text Analytics API. The connector uses the API host and the base URL to determine how to call the API.

Step 2: Specify authentication type (Security)

There are several options available for authentication in custom connectors.

1) No authentication

2) Basic Authentication (Username, Password)

3) API Key

4) OAuth 2.0

Step 3: Create the connector definition

The custom connector wizard gives many options for defining how connector functions, and how it's exposed in logic apps, flows, and apps.

Create an action

The first thing to do is create an action that calls the Text Analytics API sentiment operation.

On the Definition tab, the left pane displays any actions, triggers (for Logic Apps and Power Automate), and references that are defined for the connector. Select New action.

The General area displays information about the action or trigger that's currently selected. Add a summary, description, and operation ID for this action.

Leave the Visibility property set to none. This property for operations and parameters in a logic app or flow has the following options:

  • none: displayed normally in the logic app or flow

  • advanced: hidden under another menu

  • internal: hidden from the user

  • important: always shown to the user first

The Request area displays information based on the HTTP request for the action. Select Import from sample.

Specify the information necessary to connect to the API. select Import.

Case 1: Call a API that returns all products

Request URL: /products

Header: Content-Type = application/json

Response: List of products (JSON array)

In Header specify default value as application/json

  • The Response area displays information based on the HTTP response for the action. Select Add default response.

  • Specify the response body, and then select Import.

  • The Validation area displays any issues that are detected in the API definition. Check the status, and then in the upper-right corner of wizard, select Update connector.

Step 4: (Optional) Enable your connector as an AI plugin

Use the AI Plugin (preview) tab for a connector only if you're planning to certify connector. In order for a connector to be used as an AI plugin, the connector must be certified.

In the Plugin manifest section, enter details to enable this connector as an AI plugin.

Step 5: (Optional) Use custom code support

Custom code transforms request and response payloads beyond the scope of existing policy templates. Transformations include sending external requests to fetch additional data. When code is used, it takes precedence over the codeless definition. This means that the code will execute, and we don't send the request to the back end.

You can either paste in your code or upload a file with your code. Your code must:

  • Be written in C#.

  • Have a maximum execution time of five seconds.

  • Have a file size no larger than 1 MB.

Step 6: Test the connector

Now connector is created, test it to make sure it's working properly.

On the Test tab, select New connection.

Select Create connection.

Case 2: Get A Single Cart by Id (Path Parameter)

Request URL: /carts/{id}

Define {id} as a Path parameter

Power Automate will inject this dynamically at runtime

API end point and content type is defined

Case 3: POST Request with Body Parameters

Method: POST

Request Body: JSON with input fields

Case 4: GET with Query Parameters

  • Request URL: /category?name={categoryName}

  • Add categoryName as a Query parameter

API end point defined with query parameter

You can add Dropdown options for the caller

Now the connector is created with all 4 actions

Calling Custom Connector Form Power Automate

To call custom connector in power automate click add action

Search under Custom → Select your custom connector

The selected custom connector will display all actions defined inside it.

Use the defined actions just like any other built-in connector

Each action in the custom connector is configured to call specific API endpoints by passing appropriate parameters in the required format

In authentication action we define 2 parameters in body

In Get All Products we do not have any parameter

In Get A Single Cart action parameter is passing as Path

In Get Category Action parameter is passing as query and a Dropdown is provided to the user to select from predefined categories

Click Save, then Run the flow.

All defined actions execute successfully.

Each action returns the expected API response, confirming the connector is functioning as intended.

Method 2: Create a custom Connector by importing Postman Collections

You can quickly create a custom connector by importing an existing Postman collection. This is especially useful when you have multiple API endpoints already tested in Postman.

In Postman, go to your API collection.

Click on the three dots (⋮) next to the collection name.

Choose Export, and save it as a v2.1 or v2.0 collection file.

Choose Import a Postman Collection

Upload the exported Postman file

Select export postman file and import

Each API request from the collection will be added automatically as a separate action in the custom connector.

If your collection contains two API requests, two actions will be created under the connector.

Nilanka Sekhar Paul

Business Architecture Specialist at Accenture

4mo

Great work

To view or add a comment, sign in

Others also viewed

Explore topics