The following table compares the connection strings that your C# program needs to connect to your on-premises SQL Server versus your Azure SQL Database in the cloud. The differences are in bold.
Connection string for Azure SQL Database |
Connection string for Microsoft SQL Server |
---|---|
Server=tcp:{your_serverName_here}.database.windows.net,1433; User ID={your_loginName_here}@{your_serverName_here}; Password={your_password_here}; Database={your_databaseName_here}; Connection Timeout=30; Encrypt=True; TrustServerCertificate=False; |
Server={your_serverName_here}; User ID={your_loginName_here}; Password={your_password_here}; |
The Database= is optional for SQL Server, but is required for SQL Database.
.NET ADO SqlConnectionStringBuilder Properties - discusses all the parameters in detail.