PowerApps: Create Custom Connector to call Azure APIM API from PowerApps or Power Automate

This post describes how to create a custom connector (API connector) to call the Azure APIM from PowerApps and Flows.  This process is especially helpful to know when you would like to use the Azure APIM from a PowerApp and/or Flow and there is no connector available for the Azure APIM we wish to use.

Before creating custom connector in powerapps, the first step is registering your Azure APIM application in the Microsoft Azure Portal and keep the following security details handy in notepad

  1. Client ID
  2. Client secret
  3. Tenant ID
  4. Resource url

Let’s start step by step…

1. The first step is to export Swagger File(OpenApi 2.0) from Azure APIM of the API you wish to connect from PowerApps/Power Automate.

Create custom connector

2. In a web browser, open the PowerApps web app in Office 365

 https://web.powerapps.com

3. Click Data, then click Custom Connectors

4. Click the + New custom connector link

5. Select Import an OpenApi file

6. Select the JSON file you exported in the first step

7. Enter the custom connector name

8. Click Continue

9. Change icon, color and description if required under General Tab

10. Verify Scheme, Host and Base URL

11. Click Security tab

12. In the Choose what authentication is implemented by your API dropdown list, select OAuth 2.0

13. In the OAuth 2.0 section, in the Identity Provider dropdown list, select Azure Active Directory

14. In the Client id text box, enter the Client Id you saved to Notepad

15. In the Client Secret text box, enter the Client secret you saved to Notepad

16. In the Scope text box, enter the permissions you configured when you made the application (Directory.Read.All, Group.Read.All)

17. In the Resource URL text box, enter Client ID fot Backend App Registration i.e. https://global.consent.azure-apim.net/redirect

18. Click Definition

19. Change the Operation Id to a valid name format. In this case, we use SearchPerson

20. Set if any http header needs to be passed with request

21. Click Create connector

22. Click the Test tab

23. Click New connection

24. Click Create

25. Sign in to your Office 365 account

26. Test Search Person operation

Custom connector is added to your data sources now.

Using Custom connector inside App

Let’s use the newly created Custom connector now

1. Create a new canvas app

2. Goto Connectors under Data sources and click on newly added Custom Connector

After adding the new Datasource a new item would be visible under In your App section.

3. Now add one Text Input and one Button control and one Gallery on the screen

4. Select the button’s OnSelect function and write the code shown in the screen below

In the code below we are calling the newly added Custom Connector’s Search Person Operation and the result is being stored inside a Collection. This collection it the datasource for the gallery on this screen.

5. Run the app and enter some text inside text input.

All matching records would be displayed in the gallery with Name, Image and status.

CONCLUSION

The Power Automate platform gives users an unprecedented way of automating business processes without the need to have coding knowledge. The platform gives the user the ability to create powerful workflows and connect to external systems like never before.

In this blog, I explained to you how you can formulate your custom connector for Power Apps through a series of steps. If you have any confusion, questions or insights, leave a comment below!

60 thoughts on “PowerApps: Create Custom Connector to call Azure APIM API from PowerApps or Power Automate

    1. Hi
      Thanks for visiting.
      To start your own website you need to do following things:
      1. Buy a domain & website hosting it would cost you around USD10-15 per year
      2. Use WordPress to make your log, it’s free.

  1. Oh my goodness! Impressive article dude! Thank you, However I am having problems with your RSS.
    I don’t know the reason why I can’t join it. Is there anybody
    getting similar RSS issues? Anyone that knows the solution can you kindly respond?
    Thanx!!

  2. Greate pieces. Keep writing such kind of info on your blog.
    Im really impressed by your blog.
    Hello there, You have performed a great job.
    I will certainly digg it and individually suggest to my friends.
    I’m confident they will be benefited from this website.
    0mniartist asmr

  3. Heya i am for the first time here. I came across this board and I find
    It really useful & it helped me out much. I hope to give something back and help
    others like you helped me. 0mniartist asmr

  4. I am not sure where you’re getting your info, but great
    topic. I needs to spend some time learning much more or understanding more.
    Thanks for wonderful info I was looking for this information for my mission.

  5. Thanks for some other fantastic article. The place else may anyone get that type of
    information in such a perfect method of writing? I have a presentation subsequent week, and I’m on the look for such info.

  6. My brother suggested I might like this web site. He was totally
    right. This post actually made my day. You cann’t imagine simply how much time I had spent for this information! Thanks!

  7. Terrific post however , I was wanting to know if you could write a litte more on this subject?
    I’d be very grateful if you could elaborate a little bit further.
    Many thanks!

  8. It’s awesome to go to see this web page and reading the views
    of all mates on the topic of this paragraph, while I am also keen of getting
    know-how.

  9. Hello there! I just wish to give you a big thumbs up for
    the excellent information you’ve got here on this post.
    I’ll be coming back to your website for more soon.

  10. Wow, amazing blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your site is excellent, let
    alone the content!

Leave a Reply

Your email address will not be published.

  +  73  =  82