Create PowerApps Application with On-premises SQL Server

Copper Contributor

PowerApps is a one of the powerful low code applications from Microsoft, which helps to develop millions of applications within a minute. Only platform which allows technical and non-technical to implement application with their requirements. Power platforms can be developed to receive data from different data sources like Excel, SQL server, share point resources and data from different cloud storages like Google, OneDrive, etc.

Considering OnPrem data sources we do traditional coding to connect the application with the data source. But here we have a possibility to develop a PowerApps and receive data from On Prem SQL server. In this article I will show you how to connect OnPrem SQL to PowerApps.

Pre-Requites
1) 
OnPrem SQL Server
2) PowerApps Subscription
3) On-Premises Data Gateway
4) Internet Connection

On-Premises Data gateway for Power Apps

On-Premises gateway is a bridge which provides most secure communication in between local sources to cloud applications. To know and learn more about On-Premises data gate way: What is an on-premises data gateway? — Power Apps | Microsoft Learn

SQL Server on Windows 10 Machine

I have SQL database installed on my Windows 10 machine, which is a local machine with the active internet connection. If you are new to SQL server installation and configure, I have shared some other posts which will show you how to install and configure SQL server 2022 in your test environment.

Download SQL Server 2022: SQL Server 2022 Trial (microsoft.com)

To Confirm your Installed Version: SELECT @@VERSION

Gohulan_0-1672647303983.png

 

I have created a table named Demo Data and inserted some sample data

Gohulan_1-1672647303817.png

 

Let’s configure the On-Premises Data Gateway

Gohulan_2-1672647304401.png

 

To Download the On-Premises Data Gateway for PowerApps please download the Gateway from below link — Downloads | Microsoft Power Apps.
Once it’s downloaded install it to the local machine, it will take some time to install. When installation succeed it will prompt a dialog box to enter the Microsoft account details. Use the same account which you used to create PowerApps.
In the next step create a Gateway with the valid security and recovery key. Here I named my gateway as DEMOPOWERAPPS

Gohulan_3-1672647304742.png

 

Create Configure button to apply the configurations and close the dialog box, now it’s done.

Gohulan_4-1672647304146.png

 

Now it’s time to build the app in PowerApps

Go to PowerApps portal to make the app — make.powerapps.com

Gohulan_5-1672647304316.png

 

I am going to create the PowerApps with SQL data source

Click the SQL and add the New Connection and select the connection source as SQL database (SQL Server).

In the authentication type select SQL Server Authentication from the drop-down list. In the source selection pane select Connect using on-premises data gateway as data source for SQL server

Gohulan_6-1672647304322.png

 

SQL Server Name — Windows 10 Local PC Name
SQL Database Name- POWERAPPSDEMO
Username- demouser
Password-[Your SQL User Password Here]

Gohulan_7-1672647304327.png

 

In the bottom you need to select the installed gateway, here it will show the gateways you installed with the Microsoft account which you used to create the PowerApps.

Gohulan_8-1672647303853.png

 

Here my installed DEMOPOWERAPPS gateway is listed and it’s showing, if your gateway is not listed, please refresh the gateway list. Once you select the correct gateway click create to link the data source to PowerApps.

It will show the available tables once the gateway connection is succeeded, here my table DemoData is showing. I am going to use the DemoData table to connect with PowerApps.

Gohulan_9-1672647304309.png

 

In case in the same database if you want to change or create new table you can either create it from here or choose different one.
Click connect to link the On Prem database with PowerApps, It’s done and app is automatically created now.

Gohulan_10-1672647304346.png

 

Without doing any additional changes in the app I will see the preview of the app to check to see whether it’s communicating correctly with the SQL database available at my laptop.

The data which I entered manually using SQL commands are appearing here, it means it’s perfectly connected with the on prem SQL database.

Gohulan_11-1672647303847.png

 

By adding an edit form in the PowerApps you can be able to insert the data from PowerApps to On Prem SQL Server.

Just try this by yourself and let me know if you have any issues in connect On Prem SQL server to Power apps.

 

Happy Coding!!

0 Replies