Skip links
installing custom connector blog

Steps for Installing Custom Connector

Steps to Create a custom connector for a web API

Now you can create your own custom connector and you can also submit it to Microsoft to publish and make it available for all the regions. Unlike the SharePoint Apps, Custom Connector don’t provides the Licensing Mechanism, you have to create your own.

First you need to create Web API for which you want to create Custom Connector:

Open Visual Studio, then choose File > New Project. a. Expand Installed, go to Templates > Visual C# > Web, and select ASP.NET Web Application. b. Provide a project name, location, and solution name for your app, then choose OK.

In the New ASP.NET Web Application box, select the Web API template. If not already selected, select Host in the cloud. Choose Change Authentication.

Select No Authentication and choose OK. You can set up authentication later.

When the New ASP.NET Web Application box reappears, choose OK.

Create App Service box, you can skip this step.

You can create web App on azure and download the Publishing profile and import that during the publish also copy Client id and generate Client Secrete while creating web app on azure.

After Visual Studio deploys your project, build the code for your app.

Create an OpenAPI (Swagger) file that describes your Web API

To connect your Web API app to Microsoft Flow , you need an Swagger file that describes your API’s operations. Steps to create Swagger File: If you haven’t already, install the Swashbuckle Nuget package in your Visual Studio project.

a. In Visual Studio, choose Tools > NuGet Package Manager > Package Manager Console.

b. In the Package Manager Console, go to your app’s project directory if you’re not there already (run Set-Location “project-path”), and run this PowerShell cmdlet: Install-Package Swashbuckle

For example:

When you will run your app after installing Swashbuckle, Swashbuckle generates an OpenAPI file at this URL: https://{your-web-api-app-root-URL}/swagger/docs/v1 Swashbuckle also generates a user interface at this URL: https://{your-web-api-app-root-URL}/swagger When you’re ready, publish your Web API app to Azure.

To publish from Visual Studio, right-click your web project in Solution Explorer, choose Publish…, and follow the prompts. Get the OpenAPI document by browsing to this location: http://{your-web-api-app-root-URL}/swagger/docs/v1 Save the content as a JSON file. Based on your browser, you might have to copy and paste the text into an empty text file.

Set up Azure Active Directory authentication

You will have to create two Azure Active Directory (AAD) applications in Azure. First AAD application: Securing the Web API The first AAD application is used to secure the Web API. Lets name it webAPI. Sign-on URL: https://login.windows.net Reply URL: https:///.auth/login/aad/callback There is no need for a client key.

There is no need to delegate any permissions. Copy the application ID, because you need it later. if want to create multi-tenant connector you need to set Multi-tenant to yes inside the Properties of the ADD App. Second AAD application: Securing the custom connector and delegated access The second AAD application is used to secure the custom connector registration and acquire delegated access to the Web API protected by the first application.

Name this one webAPI-customAPI . Sign-on URL: https://login.windows.net Reply URL: https://europe-001.consent.azure-apim.net/redirect Add permissions to have delegated access to Web API. Copy the application ID, because you need it later. Generate a client key and copy it, because you need it later. Here if you are planning to publish it to make available for all regions outside your organization by submitting it to Microsoft, you need to add to Reply URLs provided by Microsoft once you submit it: https://global-test.consent.azure-apim.net/redirect https://global.consent.azure-apim.net/redirect

Multi-tenant Custom Connector

if you want to create multi-tenant connector you need to set Multi-tenant to yes inside the Properties of the ADD Apps. Then add client Id of the webAPI-customAPI configured in the webAPI’s “knowClientApplications” array property in the manifest file.

Add authentication to your Azure Web App

Sign in to the Azure portal and then find the Azure Web App that you deployed in the first section. Select Settings, and then select Authentication / Authorization. Turn on App Service Authentication and then select Azure Active Directory. On the next blade, select Express. Select Select Existing AD App, and select the webAPI AAD application you created earlier. Then in Advanced blade Add Client id of webAPI.

Add the custom connector to Microsoft Flow

Firstly modify your Swagger file (Open API File ) to add the “securityDefintions “object and AAD authentication used for the Web App. The section of your OpenAPI with the host property should look like this: // File header should be above here… “host”: ““, “schemes”: [ “https” //Make sure this is https! ], “securityDefinitions”: { “AAD”: { “type”: “oauth2”, “flow”: “accessCode”, “authorizationUrl”: “https://login.windows.net /common/oauth2/authorize”, “tokenUrl”:“https://login.windows. net/common/oauth2/token”, “scopes”: {} } }, // The rest of the OpenAPI follows… Browse to Microsoft Flow, and add a custom connector. Choose Create custom connector, then choose Import an OpenAPI File. Enter a name for the custom connector, then choose Continue.

Update general details

Once you have uploaded your Swagger File, the wizard auto-detects that you are using AAD authentication for your Web API. Configure the AAD authentication for the custom connector. Client ID: Client ID of webAPI-CustomAPI Secret: Client key of webAPI-CustomAPI Login URL: https://login.windows.net ResourceUri: Client ID of webAPI RedirectURL: https://europe-001.consent.azure-apim.net/redirect Select Create and creating a connection to the custom connector.

Additionally you can also Publish your Flow Templates along with you Custom Connector. you can submit a flow template to the gallery of templates for Microsoft Flow. Templates help people not only to create flows more easily but also to imagine additional scenarios that would benefit from a flow.

Steps to Submit Flow Template

On the My Flows page, select the ellipsis (…) for a flow which you have created using you custom connector. Select Details in the menu that appears. Select More, and then select Submit as template in the menu that appears. You can only submit flows that have run successfully at least once since the last save.

Specify a meaningful title, a clear description of the scenario that your template will help automate, the biggest benefit, the number of users, number of runs, and the categories that apply for the template. Select Submit. The Microsoft Flow team verifies and possibly modifies your template. If the team approves your template, it appears in the gallery of templates for Microsoft Flow.