使用MSI时的Azure Sql Db连接字符串 [英] Azure Sql Db connection string when using MSI

查看:46
本文介绍了使用MSI时的Azure Sql Db连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出使用MSI时要使用的正确的Azure sql db连接字符串

I am trying to figure out the proper Azure sql db connection string to use, when using MSIs

我现在正在通过托管服务身份(MSI)向sql进行身份验证,并且没有用户名和密码"

I am now authenticating to sql via Managed Service Indentities (MSIs), and do not have "username and password"

连接字符串类型为ADO.NET

在使用MSI之前,我的连接字符串采用以下格式:

Prior to using MSI, my connection string was in the below format:

Server = tcp:sqlserver.azurenet,1433;初始目录= testdb;持久安全信息= False;用户ID = {your_username};密码= {your_password}; MultipleActiveResultSets = False; Encrypt = True; TrustServerCertificate = False;身份验证="Active Directory密码";

Server=tcp:sqlserver.azurenet,1433;Initial Catalog=testdb;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication="Active Directory Password";

我只是删除 User ID = {your_username}; Password = {your_password} ??

谢谢

推荐答案

使用MSI连接到Azure SQL时,连接身份验证方法是令牌.因此,您不能使用上面指示的常规连接字符串.MSI教程中有一个C#示例(请参见下文)https://docs.microsoft.com/zh-CN/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-sql 尽管我还没有自己尝试过.谢谢,米瑞克

When connecting to Azure SQL using MSI, the connection authentication method is token. Therefore you cannot use a regular connection string you have indicated above. There is a C# example available in the MSI tutorial ( see below) https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-sql although I have not tried it on my own. Thanks, Mirek

这篇关于使用MSI时的Azure Sql Db连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆