Your Microsoft Technology Development and Consulting Experts - Operating since 2000
Just as our prehistoric ancestors evolved by adopting tools like fire and stone axes, your journey as a Power Apps developer must also evolve. As your experience grows, you'll need to reach further and build more complex applications. One of the most significant milestones in this evolution is moving beyond SharePoint lists and connecting your apps to enterprise-level storage solutions like Microsoft SQL Server.
In this guide, I'll walk you through the process of:
Let's take our first steps into this bigger world of enterprise-level data management!
Head over to my YouTube channel Chino Does Stuff to watch the video tutorial, there you will see a variety of videos with loads of tricks and tips on the entire Power Platform suite.
The first step is to set up an Azure SQL database. If you're new to Azure, you can sign up for a free trial which gives you plenty of credits to explore the platform.
In the Azure Portal:
Once your server and database are created, you need to configure the firewall:
This firewall configuration is crucial as it allows Power Apps and Power Automate to connect to your database, while also letting you manage the database from your local computer.
For this tutorial, we'll create a simple inventory management system with two tables: a Stock table for inventory items and an Orders table for tracking restock orders.
To manage your database, you'll need SQL Server Management Studio (SSMS):
We'll create two tables with a simple relationship:
Let's break down what we've done:
To make testing easier, let's add some sample data to our tables:
Here's where things get interesting. Power Apps can't directly query multiple related SQL tables efficiently, so we'll create a stored procedure that joins the data for us:
This stored procedure joins the Orders and Stock tables, giving us a flattened view that's perfect for displaying in Power Apps.
Currently, Power Apps can't directly call SQL stored procedures. Instead, we'll use Power Automate as a bridge between our app and database.
Here's how to set up the flow:
The key here is the "Parse JSON" step. When you execute the flow for the first time, you can copy the JSON output from the stored procedure execution and use it to generate the schema automatically.
With the database and flow set up, we can now build our Power App:
Configure the button to call your flow and store the results:
In your gallery, add labels to display the data:
While we've covered the fundamentals of connecting Power Apps to SQL, a complete application would include:
As you continue to develop with SQL and Power Apps, remember these important points:
Moving from SharePoint lists to SQL databases is a significant evolution in your Power Apps journey. While there's certainly a learning curve, the benefits are substantial:
This tutorial covered the core functionality of using SQL with Power Apps, but there's much more to explore. In future tutorials, we'll build on this foundation to create more complete applications with full CRUD (Create, Read, Update, Delete) capabilities.
If you'd like to see more Power Apps development tutorials using SQL, please head over to the YouTube channel and leave a comment there. I actively monitor and respond to all YouTube comments!
Marcello is a lead developer at Powerplatform Experts, an expert in, Computer Science, Power Platform integration and founder of the YouTube channel ChinoDoesStuff. If you have any questions, please feel free to get in contact at via the form below.
Copyright © 2024. Brayalei Pty Ltd T/As Office Experts Group. ABN 32 093 067 737. ACN 093 067 737. All Rights Reserved.