Error "504 Gateway Timeout" occurred during execution of SQL queries.
Cause:
This error may occur when your Gateway or Proxy timeout value is low; and if you have a time-consuming database operation that exceeds the Gateway's timeout setting, the Gateway will return HTTP Code 504 to the client PC, preventing the cloud app from receiving the execution results properly.
Solution:
In such cases, consider increasing the timeout values as needed.
The following screenshot shows where to increase the timeout value in Azure Application Gateway: