{"id":11935,"date":"2020-03-12T12:59:00","date_gmt":"2020-03-12T12:59:00","guid":{"rendered":"https:\/\/viewmyprojects.com\/winwirewp\/?p=11935"},"modified":"2024-03-28T05:14:27","modified_gmt":"2024-03-28T05:14:27","slug":"azure-logic-apps-custom-connector","status":"publish","type":"post","link":"https:\/\/viewmyprojects.com\/winwirewp\/blog\/azure-logic-apps-custom-connector\/","title":{"rendered":"Azure Logic Apps Custom Connector Using OpenAPI"},"content":{"rendered":"\n<p>Azure Logic Apps comprises of a variety of connectors for popular SaaS, PaaS and on-premises systems. Though the current library has more than 220 connectors, it\u2019s impossible to have complete coverage for every possible method that\u2019s used within the enterprise. The good part is that the custom connectors can fill gaps in the evolving library of connectors.<\/p>\n\n\n\n<p>In this article we are going to see how to create a&nbsp;<strong>AzureLogic Apps Custom Connector<\/strong>&nbsp;using openAPI file and utilize this custom connector in a&nbsp;Logic App.<\/p>\n\n\n\n<p><strong>Prerequisites:<\/strong><\/p>\n\n\n\n<ul class=\"blog-detail-list wp-block-list\">\n<li>Open API file.<\/li>\n\n\n\n<li>Access to Azure portal.<\/li>\n<\/ul>\n\n\n\n<p>First, let\u2019s understand what a logic app, a connector and custom connector means:<\/p>\n\n\n\n<p><strong>Logic Apps<\/strong>:&nbsp;<a href=\"https:\/\/azure.microsoft.com\/services\/logic-apps\" target=\"_blank\" rel=\"noopener\">Azure Logic Apps<\/a>&nbsp;is a cloud-service that helps you schedule, automate, and orchestrate tasks, business processes, and&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/logic-apps\/logic-apps-overview#logic-app-concepts\" target=\"_blank\" rel=\"noopener\">workflows<\/a>&nbsp;when you need to integrate apps, data, systems, and services across enterprises or organizations.<\/p>\n\n\n\n<p><strong>Connector:<\/strong>&nbsp;Connectors provide quick access from Azure Logic Apps to events, data, and actions across other apps, services, systems, protocols, and platforms. By using connectors in your logic apps, you expand the capabilities for your cloud and on-premises apps to perform tasks with the data that you create and already have.<\/p>\n\n\n\n<p><strong>Custom connectors:<\/strong>&nbsp;Custom connectors are used to make call to custom APIs &amp; services.<\/p>\n\n\n\n<p><strong>Note<\/strong>: Open your API file with notepad and check if it has null as description for any of the operations and replace it with some string. Otherwise it generates an exception while creating custom connector.<\/p>\n\n\n\n<p><strong>How to Build a Custom Connector<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Login to \u201c<a href=\"http:\/\/portal.azure.com\/\" target=\"_blank\" rel=\"noopener\">http:\/\/portal.azure.com\/<\/a>\u201d, search \u201c<a href=\"https:\/\/portal.azure.com\/#blade\/HubsExtension\/BrowseResourceBlade\/resourceType\/Microsoft.Web%2FcustomApis\" target=\"_blank\" rel=\"noopener\"><strong>Logic Apps Custom Connector<\/strong><\/a>\u201d and click on \u201c<strong>Add<\/strong>\u201d. Enter below details:<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/1-1.webp\" alt=\"\" class=\"wp-image-11936\"\/><\/figure><\/div>\n\n\n<p>Select resource group. Click on \u201cReview and create\u201d and then \u201cCreate\u201d. Once deployed click on \u201cGo to resource\u201d which will open the connector.<\/p>\n\n\n\n<p>Now it is time to design the custom connector. To design custom connector, click on \u2018Edit\u2019.<\/p>\n\n\n\n<p>Now you might have to zoom out to see all the options on next screen (refer screenshot). API endpoint should be \u201cREST\u201d. Import mode should be \u201cOpenAPI file\u201d and then click on import button to browse and select your open API file.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/2-3.webp\" alt=\"\" class=\"wp-image-11937\"\/><\/figure><\/div>\n\n\n<p>Once file is selected it automatically fills all the required details \u201cScheme\u201d, \u201cHost\u201d &amp; \u201cBase URL\u201d into \u201cGeneral information\u201d section. You can add icon background color and description.<\/p>\n\n\n\n<p>Now click on \u201cSecurity\u201d tab. In security tab: Edit authentication type to API Key.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/3-4.webp\" alt=\"\" class=\"wp-image-11938\"\/><\/figure><\/div>\n\n\n<p>In \u2018parameter label\u2019 enter API Key. Now connector can access API.<\/p>\n\n\n\n<p>Click on \u2018Definition\u2019. Next screen shows you all the operations from your API. At the right top click on update connector.<\/p>\n\n\n\n<p>Custom connector is created. Now it\u2019s time to consume this custom connector in a Logic App. Let\u2019s create a logic app first in our next step.<\/p>\n\n\n\n<p>2. Go to home page, search \u201c<strong>Logic apps<\/strong>\u201d, click on add and enter details in below screen:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/4-1.webp\" alt=\"\" class=\"wp-image-11939\"\/><\/figure><\/div>\n\n\n<p>Click on \u201cReview and create\u201d and then \u201cCreate\u201d. Once deployed click on \u201cGo to resource\u201d button.<\/p>\n\n\n\n<p>Which takes you to logic app designer page shown below, click on \u201c<strong>When a HTTP request is received<\/strong>\u201d. We have selected HTTP request as the trigger for our logic app. In simple words, to run our logic app we need to make a HTTP request to URL generated in this step.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/5-1.webp alt=\" alt=\"\" class=\"wp-image-11940\"\/><\/figure><\/div>\n\n\n<p>On next screen click on \u201cNew step\u201d, click on \u201cCustom\u201d to see all the custom connectors available. Now select your custom connector and under actions select \u201cGetEmployees\u201d.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/6-1.webp\" alt=\"\" class=\"wp-image-11941\"\/><\/figure><\/div>\n\n\n<p>Now you will be asked to create a connection. Type connection name and enter API Key in second text box. Usually it is labelled as your API key. Click on \u201cCreate\u201d.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/7.webp\" alt=\"\" class=\"wp-image-11942\"\/><\/figure><\/div>\n\n\n<p>On successful creation of connection you see below screen:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/8-2.webp\" alt=\"\" class=\"wp-image-11943\"\/><\/figure><\/div>\n\n\n<p>Now click on \u201cNew step\u201d and search for response and then select \u201cResponse\u201d under actions.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/9-2.webp\" alt=\"\" class=\"wp-image-11944\"\/><\/figure><\/div>\n\n\n<p>On click of \u201cResponse\u201d under actions you see below screen. Keep the status code as 200 and in body select \u201cBody\u201d under GetEmployees.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/10.webp\" alt=\"\" class=\"wp-image-11945\"\/><\/figure><\/div>\n\n\n<p>On top left corner click on save to save the Logic app. After saving logic app in first step a URL is generated as shown below. Keep this URL to test the logic app.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/11-1-1.webp\" alt=\"\" class=\"wp-image-11946\"\/><\/figure><\/div>\n\n\n<p>Before testing let us understand what we are doing in logic app.<\/p>\n\n\n\n<ul class=\"blog-detail-list wp-block-list\">\n<li>In first step, we selected \u201cWhen a HTTP request is received\u201d as trigger. Which means logic app is triggered when a POST request is made to the URL generated in this step.<\/li>\n\n\n\n<li>In next step first we added custom connector, created a connection to access the API and called custom connector operation \u201cGetEmployees\u201d to get the list of employees.<\/li>\n\n\n\n<li>Lastly, we are returning the custom connector output as the response of the logic app. So, logic app will return us a list of employees along with 200 status code. We can see the \u201cRun history\u201d of the logic app by going to \u201cOverview section\u201d in home page of logic app.<\/li>\n<\/ul>\n\n\n\n<p>Logic app can be triggered\/tested by making a&nbsp;<strong>POST<\/strong>&nbsp;request to the logic app URL from Postman.<\/p>\n\n\n\n<p><strong>Calling a Parametrized Operation from Custom Connector<\/strong><\/p>\n\n\n\n<p>Consider an API operation \u201cGetEmployeeById\u201d which accepts empId as input parameter. How do we implement this?<\/p>\n\n\n\n<p>This time we will investigate only the step different from previous example:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Now we must pass an employee id from Postman while triggering the logic app which will be passed further to custom connector.<\/li>\n<\/ol>\n\n\n\n<p>While creating logic app: In first step click on \u201cUse sample payload to generate schema\u201d and paste this JSON object&nbsp;<strong>{\u201cempId\u201d : 1 }&nbsp;<\/strong>in pop up and click \u201cDone\u201d to generate schema.<\/p>\n\n\n\n<p><strong>Note<\/strong>: Payload is the JSON you pass to Logic app. It might have properties as per your requirement e.g.<\/p>\n\n\n\n<p>\u00ad{\u201cempId\u201d : 1,\u201dfirstName\u201d : \u201cJohn\u201d,\u201dlastName\u201d : \u201cCena\u201d }<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/12.webp\" alt=\"\" class=\"wp-image-11947\"\/><\/figure><\/div>\n\n\n<p>2. In next step we get the empId from payload into a newly declared variable called empId. Pass this variable (notice purple color for variable) to operation \u201cGetEmployeeById\u201d. Response of logic app is what we received from operation \u201cGetEmployeeById\u201c.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/13.webp\" alt=\"\" class=\"wp-image-11948\"\/><\/figure><\/div>\n\n\n<p>This time while triggering the logic app we pass the JSON object containing empId property and in response we get employee data.<\/p>\n\n\n\n<p><strong>Benefits of Using Custom Connectors<\/strong><\/p>\n\n\n\n<ul class=\"blog-detail-list wp-block-list\">\n<li>The connector can be shared with other teams in our organization for reusability.<\/li>\n\n\n\n<li>Custom connectors support 4 different types of authentication: API Key, Basic Auth, None &amp; OAuth2.<\/li>\n\n\n\n<li>We can get our custom connector certified from Microsoft.<\/li>\n<\/ul>\n\n\n\n<p><strong>Conclusion<\/strong>: We have created a custom connector to access web API operations and understood how to generate schema from payload which can be used as an input to the custom connector.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure Logic Apps comprises of a variety of connectors for popular SaaS, PaaS and on-premises systems. Though the current library has more than 220 connectors, it\u2019s impossible to have complete coverage for every possible method that\u2019s used within the enterprise. The good part is that the custom connectors can fill gaps in the evolving library&hellip; <a class=\"more-link\" href=\"https:\/\/viewmyprojects.com\/winwirewp\/blog\/azure-logic-apps-custom-connector\/\">Continue reading <span class=\"screen-reader-text\">Azure Logic Apps Custom Connector Using OpenAPI<\/span><\/a><\/p>\n","protected":false},"author":60,"featured_media":16504,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_eb_attr":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-11935","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","entry"],"acf":[],"featured_image_src":"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom.webp","author_info":{"display_name":"Tisham","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/tisham\/"},"views":4015,"uagb_featured_image_src":{"full":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom.webp",800,440,false],"thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom-150x150.webp",150,150,true],"medium":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom-300x165.webp",300,165,true],"medium_large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom-768x422.webp",750,412,true],"large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom.webp",750,413,false],"1536x1536":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom.webp",800,440,false],"2048x2048":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom.webp",800,440,false],"post-thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/10\/Azure-Logic-Apps-Custom.webp",800,440,false]},"uagb_author_info":{"display_name":"Tisham","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/tisham\/"},"uagb_comment_info":0,"uagb_excerpt":"Azure Logic Apps comprises of a variety of connectors for popular SaaS, PaaS and on-premises systems. Though the current library has more than 220 connectors, it\u2019s impossible to have complete coverage for every possible method that\u2019s used within the enterprise. The good part is that the custom connectors can fill gaps in the evolving library&hellip;&hellip;","_links":{"self":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/11935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/comments?post=11935"}],"version-history":[{"count":2,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/11935\/revisions"}],"predecessor-version":[{"id":18314,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/11935\/revisions\/18314"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media\/16504"}],"wp:attachment":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media?parent=11935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/categories?post=11935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/tags?post=11935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}