[英]how to get connection string in .net core to Azure SQL without Entity Framework?
I am currently created one Aspnet core C# web api search, which need connected to Azure SQL server. I am currently created one Aspnet core C# web api search, which need connected to Azure SQL server.
Anyone know what is the connection String I need to use?任何人都知道我需要使用的连接字符串是什么?
We have some existing stored procedures, and want to call it directly without using Entity Framework Core.我们有一些现有的存储过程,并希望不使用 Entity Framework Core 直接调用它。
Here is my Azure Data Studio login information.这是我的 Azure Data Studio 登录信息。
Here is the code I am using to get connect to Azure SQL这是我用来连接到 Azure SQL 的代码
string connectionString = "Server=testServer.database.windows.net;Database=testDB; Authentication=Active Directory Integrated;";
using (SqlConnection sqlConnection = new SqlConnection(connectionString))
{
try
{
sqlConnection.Open();
}catch(Exception ex)
{
}
}
Thanks谢谢
After a couple of hours testing and I found one connection string which is working for me.经过几个小时的测试,我发现了一个对我有用的连接字符串。
string connectionString = "Data Source=server.database.windows.net;Initial Catalog=dbname;User ID=abc@def.com;Password='testing password'; Authentication='Active Directory Password'";
Hope this one can help other people who use Azure Active Directory - Universal MFA Support希望这个可以帮助其他使用Azure Active Directory 的人 - Universal MFA Support
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.