将Sql Server 2014数据库连接到Azure VM

时间:2022-04-23 04:17:51

I just created a new SQL Server 2014 VM from Windows Azure gallery. I did remote login into VM , on trying to login into DB with Windows Authentication mode, I get below error:

我刚从Windows Azure库创建了一个新的SQL Server 2014 VM。我做了远程登录到VM,尝试使用Windows身份验证模式登录到数据库时,我得到以下错误:

Login failed for user 'dbserver\dba1'. (.Net SqlClient Data Provider)

用户'dbserver \ dba1'登录失败。 (.Net SqlClient数据提供程序)

Are there any specific steps, which I have to follow for new SQL Server DB login to work properly?

是否有任何特定的步骤,我必须遵循这些步骤才能使新的SQL Server DB登录正常工作?

P.S. I have opened port 1433 into windows firewall, it did not help, althoug that should not be required for logging in directly from VM.

附:我已经将端口1433打开到Windows防火墙中,它没有帮助,但是直接从VM登录不需要这样做。

2 个解决方案

#1


3  

I guess Azure VM is not joined to domain. This means that only SQL authentication will work against this SQL Server instance. You might need to do the following:

我猜Azure VM没有加入域。这意味着只有SQL身份验证才能对此SQL Server实例起作用。您可能需要执行以下操作:

  • Enable Mixed authentication on the SQL Server
  • 在SQL Server上启用混合身份验证

  • Add a user mapped to SA role (or enable SA and set its password, but having separate user is better)
  • 添加映射到SA角色的用户(或启用SA并设置其密码,但具有单独的用户更好)

  • Open port 1433 (you did this already)
  • 打开端口1433(你已经这样做了)

  • Make sure SQL is listening on this port (should be already)
  • 确保SQL正在侦听此端口(应该已经存在)

  • In case you connecting outside of the same Azure Cloud Service - make sure you have endpoint created for the VM. Highly recommended to use port different from 1433 as the endpoint public port.
  • 如果您在同一Azure Cloud Service外部进行连接 - 请确保为VM创建了端点。强烈建议使用与1433不同的端口作为端点公共端口。

Don't forget to specify port if it is not standard, SQL connection string expects comma for it (i.e. myvmpublicname.cloudapp.net,12345)

如果它不是标准的,请不要忘记指定端口,SQL连接字符串需要逗号(即myvmpublicname.cloudapp.net,12345)

You can check this article for more details

您可以查看此文章以获取更多详细信息

#2


0  

It most likely installed another windows user as the admin for the SQL Database. If you know what that user is, login as them.

它很可能安装了另一个Windows用户作为SQL数据库的管理员。如果您知道该用户是什么,请以他们身份登录。

Otherwise, did you manage to set up the SQL in mixed mode and have an sa password. If so, login with that then add the Windows Account.

否则,您是否设法以混合模式设置SQL并具有sa密码。如果是,请使用该登录,然后添加Windows帐户。

If not, try Forgot SQL Server Password to reset the sa password and get access that way.

如果没有,请尝试忘记SQL Server密码以重置sa密码并以此方式访问。

#1


3  

I guess Azure VM is not joined to domain. This means that only SQL authentication will work against this SQL Server instance. You might need to do the following:

我猜Azure VM没有加入域。这意味着只有SQL身份验证才能对此SQL Server实例起作用。您可能需要执行以下操作:

  • Enable Mixed authentication on the SQL Server
  • 在SQL Server上启用混合身份验证

  • Add a user mapped to SA role (or enable SA and set its password, but having separate user is better)
  • 添加映射到SA角色的用户(或启用SA并设置其密码,但具有单独的用户更好)

  • Open port 1433 (you did this already)
  • 打开端口1433(你已经这样做了)

  • Make sure SQL is listening on this port (should be already)
  • 确保SQL正在侦听此端口(应该已经存在)

  • In case you connecting outside of the same Azure Cloud Service - make sure you have endpoint created for the VM. Highly recommended to use port different from 1433 as the endpoint public port.
  • 如果您在同一Azure Cloud Service外部进行连接 - 请确保为VM创建了端点。强烈建议使用与1433不同的端口作为端点公共端口。

Don't forget to specify port if it is not standard, SQL connection string expects comma for it (i.e. myvmpublicname.cloudapp.net,12345)

如果它不是标准的,请不要忘记指定端口,SQL连接字符串需要逗号(即myvmpublicname.cloudapp.net,12345)

You can check this article for more details

您可以查看此文章以获取更多详细信息

#2


0  

It most likely installed another windows user as the admin for the SQL Database. If you know what that user is, login as them.

它很可能安装了另一个Windows用户作为SQL数据库的管理员。如果您知道该用户是什么,请以他们身份登录。

Otherwise, did you manage to set up the SQL in mixed mode and have an sa password. If so, login with that then add the Windows Account.

否则,您是否设法以混合模式设置SQL并具有sa密码。如果是,请使用该登录,然后添加Windows帐户。

If not, try Forgot SQL Server Password to reset the sa password and get access that way.

如果没有,请尝试忘记SQL Server密码以重置sa密码并以此方式访问。