Let's start by opening Visual Studio and creating a new project using a Visual
C# console application. Provide a name for the project.
Below is a small program we took from an official Azure tutorial to test
connection to a SQL Azure database.
On the connection string the Server parameter holds the name of the SQL Azure
database server separated of the TCP port 1433 with a comma.
Scrolling to the right we can see more parameters of the connection string like
the Database parameter, where we need to specify the name of the database
created on the database server mentioned above. In this case, the name of the
database is AdventureWorks.
Next we need to specify the User Id and Password of a login with permissions
to access the database.
The Encrypt and TrustServerCertificate parameters are described on
this article.
The last parameter is the connection timeout parameter that is always related to
the amount time a connection waits to time out.
Let's test connection to the Azure database as shown below.
If the connection is successful, below is the expected result.
References.
Connect to SQL Database by using .NET (C#)