Create and configure custom connectors for PowerApps and MSFlow from AzureFunctions
I have already discussed How to Create, Configure and Deploy AzureFunction using VisualStudio and how to create swagger(OpenApi) endpoint for AzureFunctions. So, In this article will see how to import and use them in PowerApps & MSFlow.
Upon completion of yaml definition creation, Click->Export to PowerApps + Flow button or copy the API definition URL.
Alternatively you can also download ApiDef.json file.
Go to https://web.powerapps.com and authenticate then select 'Custom Connectors' from the left navigation. Then Click Create custom connector->Import an OpenApi from URL as mentioed below.
Enter function secret code which we copied earlier, Then name the connector and click Contiue.
Now, Fill values in each wizard
General -> Upload/configure connector icon.
Security -> In my scenario I used 'Function' scope access. configure it as appropriate.
Definition -> Ensure you have the proper parameter setup and response setup and Create connector.
✌ Stay calm and watch the below steps ✌
How to Test custom connector
Edit the connector from the listing
Provide function secret
Refer here to for step to get function secret key - It's only needed if you have configured AzureFunction "Function, Admin" Access rights. for "Anonymous" you can simply press allow.
Set(ReturnValue, RatsubCryptoAPI.Execute(ddlAction.Selected.Value,txtCryptoKey.Text,txtValue.Text))
Related Articles:
Create serverless Azure Functions
create swagger(OpenApi) enpoint for AzureFunctions
Step-by-step PowerApps development from scratch series
What is MSFlow?
Fill all mandatory query parameters and click Test Operation button
Crypto Encrypt call response:
Crypto Decrypt call response:
With this, we have completed setting up the custom connector. Now will see how to use in PowerApps.
Consume Custom Connector in PowerApps
So far I have configured the custom connector. Now go to https://create.powerapps.com
and authenticate.
Design your app
Create/open the project where you want to consume it. I wrote a step-by-step powerapps development series refer it as needed.
Finally, I have created a simple interface to interact with my connector.
Consume connector
From ribbon select View -> DataSource -> Add datasource
Wire-up OpenApi to action
Select button and add formula to call Azure function via custom connector
Set - Inbuilt method to assign the value to a variable.
ReturnValue - The custom variable which holds return response from the API call.
Use variable to extract API response
Showtime
Alright, now run the app to see the result
Crypto function encrypt API call
Crypto function decrypt API call
I'd recommend you to have a look at my previous articles for better understanding this series.
-Ratsub
Create serverless Azure Functions
create swagger(OpenApi) enpoint for AzureFunctions
Step-by-step PowerApps development from scratch series
What is MSFlow?
Comments
Post a Comment
Enter your comments..