Integrate Azure Logic App with PowerApps using Power Automate

In this blog, we will showcase how to setup Azure Logic App and how to integrate it with PowerApps using Power Automate HTTP Post Request.

Scenario

We have an Excel file that contains students’ data. This Excel file is located on a SharePoint site. We want to enable the user to search for the student id in PowerApps and get the details of the student.

1. Setting up Azure Logic App

Create an Azure account if you don’t have one already.

Go to the Azure portal.

Azure Portal

Click on the “Create a resource” button.

Create Azure Resource

Search and select “Logic Apps” by Microsoft.

Logic App in Azure

Click on the “Create” button.

Creating Azure Logic App

Select the “Subscription”, and “Resource group”, write the “Name”, and click on the “Review + Create” button.

Configuration of Azure Logic Apps

Click on the “Create” button.

Create Azure Logic App

The Logic App resource is successfully created.

Logic App is created

2. Creating an Integration Account

Go to the Azure portal and click on the “Create resource” button.

Creating Azure Resource

Search and select “Integration Account” by Microsoft.

Searching Microsoft Integration Account

Click on the “Create” button.

Creating Azure Integration Account

Select the “Resource group”, write the “Name”, and click on the “Review + Create” button.

Creating Azure Integration account

Click on the “Create” button.

Create button of Microsoft Integration Account

Open the “Logic App” resource that you have created in the first step.

Open the “Workflow Settings”, select “Integration Account”, and click on the “Save” button.

Configuring Workflow setting

3. Design the Logic App

Open the “Logic App” resource.

Open the “Logic app designer” and select the “HTTP Request-Response” template.

HTTP Template Azure Logic App

You will see the following screen.

Azure Logic App

Copy the “URL” of the trigger action to use in the next steps.

URL Of HTTP Trigger

Copy and paste the following schema in the trigger action.

Schema

{
   “properties”: {
        “ID”: {
            “type”: “integer”
        }
    },
    “type”: “object”
}

Post Schema in HTTP Trigger

Add a “Get a row” action.

Select the “Site”, select the “Library”, select the “File”, select the “Table”, and select the “Key column”.

In the “Key Value”, add the “ID” coming from the trigger action.

Get a row action in Logic App

Open the “Response” action.

In the “Body” field, pass the “Body” of the “Get a row” action.

Logic App Response action

The Logic app is ready, save it.

4. Create the Power Automate flow

Now we create a Power Automate flow that will bridge the Azure Logic App and the PowerApps.

Create an “Instant” flow.

Power Automate Instant flow

Add an “Initialize variable” action.

In the “Name” field write “varID”, select “Integer” in the “Type” field, and for the “Value” field click on “Ask in PowerApps”.

Power Automate Intialize variable

Add an “HTTP” action and do the following configurations.

Method: Post

URL: URL of Logic App trigger

Body:

{
“ID”: varID variable
}

Power Automate HTTP Trigger action

Add a “Respond to PowerApps” action.

Write “Result” as the parameter name and body(‘HTTP’) as an expression.

PowerApps respond action

The flow is ready, save it.

5. Integrate with PowerApps

We have a Canvas application with a “Button” and “Labels” to show the results.

PowerApps Canvas application

Connect the Power Automate flow that we created in the previous step.

You can click here to see how to connect Power Automate flow with PowerApps.

Connecting flow with PowerApps

Select the “OnSelect” property of the “Search” button, copy the code given below, and paste it into the top bar.

Code:

Set(
    varResult,
    GetDataFromLogicApp.Run(Value(SearchInput.Text)).result
)

Power Automate code in PowerApps

The flow returns the result in a JSON string format so we can present the results as follows.

Select the “Label” and use the following code to show the “First Name” of the student.

Code:

Text(ParseJSON(varResult).FirstName)

PowerApps show text code

Replace the column name and do the same for the other Labels.

PowerApps show label code

6. Test the app

Play the app, and search for a student id.

Play PowerApps

Conclusion

We can use Azure Logic Apps with PowerApps using Power Automate flow. To do this, create a Logic App in Azure, copy the URL of the HTTP trigger, send an HTTP request from Power Automate flow, and return the results to PowerApps.

That’s IT Folks