"When you connect to an Azure SQL Database, idle connections may be terminated by a network component (such as a firewall) after a period of inactivity. There are two types of idle connections, in this context:
(1) Idle at the TCP layer, where connections can be dropped by any number of network devices.
(2) Idle by the Azure SQL Gateway, where TCP keepalive messages might be occurring (which makes the connection not idle from a TCP perspective), but not had an active query in 30 minutes. In this scenario, the Gateway will determine that the TDS connection is idle at 30 minutes and terminates the connection.
To address the second point and avoid the Gateway terminating idle connections, you can:
(1) Use the Redirect connection policy to configure your Azure SQL data source.
(2) Keep connections active via lightweight activity. This method isn’t recommended and should only be used if there are no other possible options."
For more information, please read here.