In the previous article, we have seen what are logic apps and how easy is to create a logic app using Azure portal. If you want to check those two blogs below are the links to those articles:
In this article, we will have look at how to create custom connectors.
Why custom connectors ?
As we know, Logic Apps enables orchestration and you can integrate with other services, data and apps across enterprises or organizations.
Connectors enable logic app to integrate with the data and business processes. There are many pre-built connectors which can be used for this purpose.
Sometimes you may want to integrate with APIs, Services and Systems that are not available as pre-built connectors. To support such scenarios, we can create custom connectors with their own triggers and actions.
All these connectors are function based, meaning data is returned based on calling specific functions in the underlying service.
What are custom connectors ?
A custom connector is essentially a wrapper around RESTful API that allows underlying service to talk with logic apps. So even before creating a custom connector, you need a working RESTful API.
Please note that Logic Apps also support SOAP APIs.
How to crate a custom connector ?
This section provides information on which steps should be performed before creating custom connectors, how to create custom connector and optionally, what steps can you perform after creating custom connector (in addition to using it in logic app designer).
Create RESTful API which has methods to interact with apps / systems / data you want to use in logic apps.
You can implement the API using any platform and host it on any cloud (or on-premise) platform.
For APIs created using .Net, you can use
Once the API is built, you can get the API secured by implementing any standard authentication methods from below:
- Generic OAuth 2.0
- OAuth 2.0 for specific services, including Azure Active Directory (Azure AD), Dropbox, GitHub, and SalesForce
- Basic authentication
- API Key
You can also use Azure AD for securing your API from Azure portal. You do not need to write any code for this. For more information about Azure AD for custom connectors, see Secure your API and connector with Azure AD.
Once API implementation and authentication part is done, next step is to describe your API. You can describe your API using any of the below method:
OpenAPI definitions and Postman collections use different formats, but both are language-agnostic, machine-readable documents that describe your API’s operations and parameters.
You can generate these documents from various tools, based on the language and platform used by your API.
For .Net web API implementation, you can check how to enable swagger in your API implementation. Then swagger.json file can be used for crating custom connector.
Define Custom Connector in Azure
This section provides information on how to create the custom connector for logic app using Azure portal.
Create new resource
For creating new connector, user need to click on “Create new resource“. From the “New resource” panel, select Integration and then select Logic Apps Custom Connector menu option.
Connector Create Panel
This will open another panel. There you can provide details about new connector -viz. unique name, subscription under which this should be created, resource group and location where this new resource should be placed.
Once resource is created, you can open the resource and then click on Edit option from the overview panel. Below snapshot shows where to find this edit option.
Updating Contract Details in Connector
Edit click will open below panel. You can provide three type of information:
There are two sections in this tab.
First section asks for API details, e.g. if the API is REST or SOAP based. It also asks if you want to import using OpenAPI or Postman collection.
In second section, you can provide icon for the connector and other details like where the API is hosted, if it is on HTTPS, description, etc.
In next tab, you can provide authentication / security related information.
You will have to click on the highlighted Edit button in order to start editing the security information.
Then, from the dropdown, you can select values from No authentication, OAuth, API Key and Basic Authentication.
Depending on what you select, you will be asked to provide further details.
The definition tab will ask you to provide action names, and triggers.
Summary and description inputs are obvious.
Operation Id is a string which should be unique to identify the operation uniquely.
Visibility has 4 options and you can select any one of them. Below are the meanings of those options:
- none: displayed normally in the logic app or flow
- advanced: hidden under an additional menu
- internal: hidden from the user
- important: always shown to the user first
If you click on add new trigger, there will be one additional input. You will need to specify the type of trigger to be either of Webhook or Polling.
That’s it, your custom connector is ready !
Use Custom Connector in Logic Apps
You use your custom connector like you use Microsoft-managed connectors. You create a connection to your API, and call any operations that the API provides in the same way that you call operations for Microsoft-managed connectors.
Optional: Share Connectors
You can optionally share the connectors with other users in your organization. This is optional step and you may want to share the connectors with other users in your organization based on project / solution needs.
For more details please refer this MSDN article for knowing how to share the connector.
Optional: Certify Connectors
You can optionally submit your custom connector to Microsoft for certification – if you want to publish it for all the users.
During this process, Microsoft reviews your connector, checks for technical and content compliance, and validates functionality for Logic Apps, Flow, and PowerApps
For more details, please refer this MSDN article for knowing how to submit the connector for certification.
Just now, I realized how long this article is. But I am sure that you have enjoyed reading this article. Please do comment and let me know your thoughts.