The On-Premises Data Gateway acts as a secure bridge that allows Power Apps and Power Automate to access data stored in local, private networks—such as SQL Server, SharePoint Server, or Oracle databases—without requiring you to open complex firewall ports or move your data to the cloud. By installing this gateway on a local server, you create a secure encrypted tunnel that pushes data to the Microsoft cloud services, ensuring that your internal data remains protected behind your corporate firewall while remaining accessible to your cloud-based applications.
What You'll Need
- A Windows Server or Windows 10/11 PC that remains powered on and connected to the network 24/7.
- Administrative privileges on the machine where the gateway will be installed.
- A Microsoft 365 account with the necessary permissions to create connections in Power Platform.
- Outbound internet access on the host machine (the gateway uses outbound ports, so you generally do not need to open inbound ports on your firewall).
- The specific credentials (username and password) for the on-premises data source you intend to connect to.
Step-by-Step
- Download the Gateway Installer: Log into the Power Apps portal. Navigate to the data or connections section and look for the option to download the On-premises data gateway. There are typically two versions: the Standard mode (recommended for multiple users and multiple data sources) and the Personal mode (intended for a single user). Choose the Standard mode for production environments to ensure high availability and shared access.
- Run the Installation: Launch the downloaded .exe file on your designated server. Follow the installation wizard prompts. When asked for the installation path, the default is usually sufficient. Ensure you are running the installer as an Administrator to avoid permission errors during the registration of Windows services.
- Register the Gateway: Once the installation completes, the gateway app will prompt you to register the gateway. Select "Register a new gateway on this computer." You will be asked to sign in with your Microsoft 365 organizational account. This links the physical hardware on your network to your specific cloud tenant.
- Name and Recover the Gateway: Give your gateway a clear, descriptive name (e.g., "NYC-SQL-Gateway-01"). This name is how you will identify the bridge when creating connections in Power Apps. You will also be asked to create or enter a Recovery Key. This is a critical password; if the server crashes or you need to move the gateway to a different machine, you cannot recover the gateway without this key. Store it in a secure password manager.
- Verify Gateway Status: After completing the wizard, the On-premises data gateway app will show a status of "Online: Ready." This confirms that the local service is successfully communicating with the Azure Service Bus.
- Create a Cloud Connection: Now, move from the server to the Power Apps web portal. Go to the Connections menu and select "New Connection." Choose the data source that matches your on-premises system (e.g., SQL Server).
- Configure Connection Details: In the connection settings, enter the server name and database name exactly as they appear on your local network. Under the "Authentication Type" dropdown, select the appropriate method (such as Windows Authentication or SQL Server Authentication).
- Link to the Gateway: Look for the dropdown menu labeled "Connect via on-premises data gateway." Select the name of the gateway you registered in Step 4. If the gateway is online and the credentials are correct, the connection will be established.
- Integrate with Power Apps: Open your Power App in the Studio. Go to the Data pane, click "Add Data," and select the connection you just created. You can now bind your galleries, forms, and tables to your local on-premises data.
Common Mistakes
One of the most frequent errors is installing the gateway in "Personal Mode" for a corporate project. Personal mode only allows the person who installed it to access the data. If you build an app and share it with colleagues, the app will fail for them because they cannot access your personal gateway. Always use Standard mode for shared business applications.
Another common mistake is installing the gateway on a workstation or laptop that is subject to sleep mode or automatic updates that trigger restarts. If the machine sleeps or shuts down, the connection to Power Apps is severed immediately, and your app will display a "Connection Error" to all users. The gateway must be installed on a server with a stable power supply and a policy that prevents automatic sleep.
Many administrators also forget to document the Recovery Key. Because this key is generated during setup and is not stored in the cloud for security reasons, losing it means you must uninstall the gateway and recreate all associated connections from scratch if the server ever needs to be migrated or restored from a backup.
Finally, users often enter the server name incorrectly. When connecting from the cloud via a gateway, you must use the internal network name or the internal IP address of the data server, not the external public IP of the company. The gateway handles the translation from the cloud to the internal network.
Tips
For high-availability environments, consider setting up a Gateway Cluster. By installing the gateway on multiple servers and adding them to the same cluster group, you ensure that if one server goes offline for maintenance, the other servers continue to route data to your Power Apps, preventing downtime.
To optimize performance, install the gateway on a machine that is physically or logically close to the data source. For example, if your SQL server is in a specific data center, put the gateway on a server in that same data center to minimize internal network latency.
Regularly check the gateway logs. The gateway provides detailed logs that can tell you if a connection is timing out due to local network congestion or if the data source is rejecting the credentials. This is much faster than guessing why a Power App is loading slowly.
When managing permissions, remember that the gateway only provides the "bridge." The user running the Power App still needs the appropriate permissions on the actual database or folder. The gateway does not bypass your internal security; it simply transports the credentials.
Troubleshooting
If the gateway status shows as "Offline," first check the Windows Services manager (services.msc) on the host machine. Look for the "On-premises data gateway service" and ensure it is status "Running." If it is stopped, try to start it manually. If it fails to start, check if the service account password has expired.
If you receive a "Gateway not found" error in the Power Apps portal, verify that you are signed into the portal with the same organizational account used to register the gateway. If you have multiple tenants, ensure the gateway was registered to the correct one.
When a connection test fails despite the gateway being online, verify the firewall settings on the data server itself. While the gateway doesn't need inbound ports from the internet, the data server must allow inbound traffic from the gateway machine on the specific port the database uses (e.g., port 1433 for SQL Server).
If you encounter "Credential Invalid" errors, try creating a local connection test using a tool like SQL Server Management Studio (SSMS) directly on the gateway machine. If you cannot connect from the gateway machine to the database locally, the issue is with your network or credentials, not the Power Platform gateway.
If the gateway is performing slowly, check the CPU and RAM usage on the host machine. The gateway can become a bottleneck if it is installed on an underpowered machine that is also running other heavy applications. Ensure the machine meets the minimum hardware requirements specified in the official documentation.
Frequently Asked Questions
Do I need to open ports in my firewall?
Generally, no inbound ports need to be opened. The gateway uses an outbound connection to the Azure Service Bus. However, you must ensure that outbound traffic on ports 443, 5671, 5672, and 9350-9354 is allowed, depending on your communication mode.
Can I install the gateway on a virtual machine?
Yes, installing the gateway on a VM is a standard practice. Just ensure the VM is configured for high availability and does not have aggressive power-saving settings that could put the OS to sleep.
What is the difference between Standard and Personal mode?
Standard mode allows multiple users to share the gateway and supports multiple data sources, making it ideal for teams. Personal mode is for a single user and cannot be shared with others.
Does the gateway store my data in the cloud?
No, the gateway does not store your data. It acts as a conduit, encrypting the data and passing it from your local source to the Power App in real-time. The data only resides in the cloud temporarily while the app is processing the request.
Can one gateway connect to multiple different databases?
Yes, a single gateway installation can handle connections to various different data sources, such as a SQL Server, an Oracle database, and a local file share, all simultaneously.
How do I update the gateway software?
Microsoft releases updates periodically. You can update the gateway by downloading the latest installer and running it over the existing installation; it will detect the current version and perform an upgrade without losing your configurations.