Make the .NET ConnectionString’s ConnectionTimeout property apply when resuming an Azure SQL Serverless Database
Currently, the only way to retry the initial connection to a paused Serverless database is to implement a custom retry policy. This seems like overkill, especially if you are using a .NET ConnectionString to configure your connection.
The .NET ConnectionString property for ConnectionTimeout sets the time to wait (in seconds) while trying to establish a connection before terminating the attempt and generating an error. This property does not work with the Serverless Azure SQL database tier. I tested this with a 1000 second timeout and the connection always fails in about 40 seconds when trying to connect to a paused database.
If the ConnectionTimeout is set high enough, the login attempt would wait until the database has resumed. Combined with the ConnectRetryCount and ConnectRetryInterval parameters, your SqlConnection object can retry the connect operation without the need for custom retry logic.
One pattern used is to securely store database connection strings as Secrets in the Azure Key Vault, where various processes query the vault for the needed connection string. This keeps you from storing passwords in your code and and creates a centralized, single place to change anything regarding a database connection that may be shared amongst different Azure processes (Functions, Logic Apps, home-grown .NET exe's running on Azure Batch, etc...).