Applies to Product - Power Apps
What’s happening?
502 Errors When Connecting PowerApps to Azure SQL Database or via APIM
Customers are encountering 502 Bad Gateway errors when attempting to connect PowerApps to Azure SQL Database or when making requests through API Management (APIM). The error indicates that the web server received an invalid response while acting as a gateway or proxy.
Reason:
The 502 error may be triggered by one or more of the following conditions:
- The Azure SQL Database has “Deny Public Network Access” set to Yes, blocking connections from public endpoints.
- The environment lacks a properly configured Virtual Network (VNET), preventing private access to the Azure SQL Database.
- The web server is unable to receive a valid response from the upstream content server.
Resolution
Follow these steps to resolve this:
- Check Azure SQL Database Settings
- Navigate to the Azure SQL Database configuration.
- Ensure “Public Network Access” is not set to Deny.
- If public access is not desired, set it to “Selected networks” and add the required VNET.
- Set Up Virtual Network (VNET)
- If private access is required, configure a Virtual Network (VNET) for Power Platform.
- Use Azure Private Link to securely connect PowerApps to Azure SQL Database.
- Refer to:
- https://learn.microsoft.com/en-us/azure/private-link/private-link-overview
- https://learn.microsoft.com/en-us/power-platform/admin/vnet-configuration
- Verify Power Platform Environment Configuration
- Confirm that the environment supports VNET integration.
- If using a default shared environment, consider creating a dedicated environment with VNET support.
- Monitor and Debug
- Use Azure Monitor, Application Insights, or Network Watcher to trace and diagnose request failures.
- Review logs for any additional errors or misconfigurations.
