How to Create Custom Connectors in PowerApps

Published on April 20, 2023

PowerApps, an application development platform provided by Microsoft, helps users create custom business applications without extensive coding or development skills

One of the most remarkable features of PowerApps is custom connectors. They enable you to connect your apps to external data sources, such as web services and APIs not natively supported by the platform. These connectors bridge PowerApps and other services like Microsoft Dynamics, Salesforce, and SharePoint together.

For example, you can create a custom connector to link your PowerApps to your company's CRM system, allowing you to access customer data in real-time and provide personalized experiences to your clients. Custom connectors also allow you to integrate PowerApps with external web services, such as Google Maps. Connecting your app to the Google Maps API lets you leverage location-based features, including mapping, geolocation, and routing, to enhance your app's capabilities.

Let’s discover the secret to maximizing your PowerApps capabilities with our expert guide on creating custom connectors.

Types of Custom Connectors

Here is a comprehensive list of the different types of custom connectors.

  • Logic App Connectors
  • Azure Functions Connectors
  • Custom API Connectors
  • SharePoint Framework Connectors
  • Office 365 Connectors
  • Dynamics 365 Connectors
  • Salesforce Connectors
  • GitHub Connectors
  • Slack Connectors

When to Use Custom Connectors?

Here are ten situations where custom connectors can be particularly useful:When integrating legacy systems

  • Using multiple cloud-based systems
  • Dealing with complex workflows
  • Data needs to be transformed before integration
  • A higher level of security is required
  • Integrating with external partners
  • Handling large volumes of data
  • Integrating with IoT devices
  • Integrating with social media platforms
  • When the out-of-the-box connector options are limited.

Building Custom Connectors for PowerApps

Let’s explore the process of building custom connectors for PowerApps to help you integrate your data sources seamlessly.

What are the Requirements?

  • Azure subscription (An Azure subscription is required to host and manage the custom connector.)
  • Understanding of the OpenAPI specification (The OpenAPI specification is the industry standard for describing RESTful APIs.)
  • Microsoft PowerApps CLI (The PowerApps CLI is a command-line interface to create and manage custom connectors.)
  • Familiarity with programming languages such as C# or JavaScript
  • Knowledge of OAuth 2.0 authentication (OAuth 2.0 is the authentication framework used by PowerApps to secure the custom connector.)
  • Access to the PowerApps portal
  • Ability to create custom connectors
  • Knowledge of RESTful API design principles (Principles include Client-server architecture, Statelessness, Cacheability, Layered system, Uniform interface, and Code on demand (optional))
  • Understanding of HTTP request and response structures
  • Familiarity with API testing and debugging tools 

A Step-by-Step Guide to Building Custom Connectors

Here is a practical guide to building a custom connector in PowerApps.

  1. Start the Custom Connector Wizard

    Navigate to the Data section and click on Custom Connectors to create a new customer connector in Power Automate. From there, select the option for creating a new custom connector, and choose to create from a blank template. For example, you can create a custom connector to a weather API.

  2. Update General Details

    In the General tab of the wizard, enter a description and update the Host to the address for the weather API. For example, you can enter "Weather API" as the description and "https://api.weather.com" as the Host.

  3. Create the Connector Definition

    Create an action called the API operation in the Definition tab of the wizard. Add a summary, description, and operation ID for this action. For example, you can create a "Get Weather" action that calls the "Current Weather" operation of the weather API.

  4. Use Custom Code Support (Optional)

    If you need to modify a request or response beyond the capabilities of the pre-existing policy templates, you can use custom code. Simply navigate to the Code tab and insert your custom code to achieve the desired transformation. For example, you can use custom code to transform the response payload to display the weather information in a specific format.

  5. Test the Connector

    In the Test tab of the wizard, enter the API key from the weather API, and then test the connector to ensure it's working properly. For example, you can enter a location and test the "Get Weather" action to retrieve the current weather information for that location.

Expert Tips for Building Effective Custom Connectors

  • Use descriptive and meaningful names for custom connectors, actions, and parameters.
  • Follow RESTful API conventions for your custom connector's API.
  • Provide clear and concise documentation for your custom connector.
  • Use OAuth 2.0 authentication to secure your custom connector.
  • Thoroughly test your custom connector to ensure it works properly.
  • Use connectors with built-in triggers to minimize polling frequency and improve performance.
  • Use caching to reduce the number of API calls and improve performance.
  • Use pagination to retrieve large datasets in smaller chunks.
  • Use versioning to manage changes to your custom connector's API over time.

Integrating Custom Connectors in PowerApps

Following are the steps involved in integrating Custom Connectors in PowerApps:

  • Go to the PowerApps portal and select the environment where you want to create the connector.
  • Click on the "New custom connector" button and provide basic details like connector name, description, and icon.
  • Define the authentication method based on the API requirements.
  • Define the actions and triggers that the API supports.
  • Define the inputs and outputs for each action and trigger.
  • Test the connector by providing sample inputs and verifying the outputs.
  • Generate the connector code and download it as an OpenAPI definition file.
  • Upload the OpenAPI definition file to the API Management service in Azure.
  • Publish the custom connector and share it with other users in your organization.
  • Use the custom connector in your PowerApps by adding it to the data sources and creating screens that consume the API actions and triggers.

Conclusion

Discover the limitless potential within the Power Platform! Seamlessly connect your app to various data sources and services, giving your users a delightful experience. Create custom connectors that cater to your specific needs and elevate your PowerApps to a new level. Start building custom connectors today and witness the difference it can make.

If you require assistance in scaling your enterprise applications or maximizing the potential of the PowerApps platform, our PowerApps experts can help you tailor the platform to meet your business needs.