Azure SQL Database Connection String

This Azure article will discuss the Azure SQL connection string.

Azure SQL Database Connection String

We need the Azure SQL Connection String from our local Visual Studio to connect to the Azure SQL Database in the cloud. We need to specify the connection strings in the config file to connect to the Azure SQL Database.

Provider System.Data.SqlClient

Standard

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <connectionStrings>
        <add name="MynewConnection"
             connectionString="Server=tcp:YourServerName.database.windows.net,1433;Initial Catalog=YourInitialCatalogName;User ID={YourUserName};Password={YourPassword};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"
             providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>
azure sql database connection string c#

MARS enabled

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <connectionStrings>
        <add name="MynewConnection"
             connectionString="Server=tcp:YourServerName.database.windows.net,1433;Initial Catalog=YourInitialCatalogName;User ID={YourUserName};Password={YourPassword};Encrypt=True;Trusted_Connection=False;MultipleActiveResultSets=True;Connection Timeout=30"
             providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>
azure sql database connection string

Azure AD Identity With Windows Authentication

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <connectionStrings>
        <add name="MynewConnection"
              connectionString="Server=tcp:YourServerName.database.windows.net,1433;Authentication=Active Directory Integrated;Database=yourdatabasename"
             providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>
sql server connection string

With Encrypted

<connectionStrings>
    <add name="MynewConnection"
         connectionString="Data Source=YourServerName;Initial Catalog=YourDBName;Integrated Security=true;Column Encryption Setting=enabled;" 
 providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>
azure sql db connection string

Connection Strings For .NET Framework Data Provider for SQL Server

Standard

connectionString="Server=tcp:YourServerName.database.windows.net,1433;Database=YourDataBaseName;User ID=YourUserID;Password=YourPassword;Trusted_Connection=False;Encrypt=True;

MARS enabled

connectionString="Server=tcp:YourServerName.database.windows.net,1433;Database=YourDataBaseName;User ID=YourUserID;Password=YourPassword;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;

Azure AD Identity With Windows Authentication

connectionString="Server=tcp:YourServerName.database.windows.net,1433;Authentication=Active Directory Integrated;Database=YourdatabaseName;

With Encrypted

Data Source=YourServerName;Initial Catalog=YourInitialCatalogName;Integrated Security=true;Column Encryption Setting=enabled;

Connection Strings For OLE DB Driver for SQL Server

With SQL Authentication

Provider=MSOLEDBSQL;Data Source=YourServerName;Initial Catalog=YourInitialCatalog;Authentication=SQLPassword;User ID=YourUserName;Password=YourPassword;Use Encryption for Data=true;

Windows authentication with SSPI

Provider=MSOLEDBSQL;Data Source=YourServerName;Initial Catalog=YourInitialCatalog;Authentication=ActiveDirectoryIntegrated;Use Encryption for Data=true;

AAD integrated authentication

Provider=MSOLEDBSQL;Data Source=YourServerName;Initial Catalog=YourInitialCatalog;Authentication=ActiveDirectoryIntegrated;Use Encryption for Data=true;

So these are a few lists of Azure SQL Database Connection String.

Conclusion

This Azure article discussed all about the Azure SQL database connection string. Thanks for reading this article !!!