Can't connect to SQLServer virtual machine

OnePage 20 Reputation points
2025-06-02T17:34:15.3066667+00:00

Can't connect to Azure SQL Server from SQL SSMS

TITLE: Connect to Server


Cannot connect to 20.51.194.18:1433.


ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) (Microsoft SQL Server, Error: 87)

For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-87-database-engine-error


The parameter is incorrect


BUTTONS:

OK


Azure SQL Database
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Manu Philip 20,206 Reputation points MVP Volunteer Moderator
    2025-06-02T18:20:37.9066667+00:00

    Hi OnePage

    Following steps can help to resolve the authentication issue:

    1. Check both the login Authentication - Windows or SQL Server
    2. Are you trying to access the local database? If so, use (.) (dot) instead of complete server name.
    3. Try accessing by enter the server name as localhost
    4. Use the correct host name like hostname\mssqlserver

    Hope this helps.


    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

  2. Andreas Baumgarten 121.5K Reputation points MVP Volunteer Moderator
    2025-06-02T18:28:25.67+00:00

    Hi @OnePage ,

    thanks for question.

    To connect to the Azure Virtual Machine running SQL Server using port 1433 you need to allow inbound communication for TCP port 1433 in the Network Security Group(s) (NSG(s)) related to the virtual Network subnet and/or the Azure VM.

    Please take a look here: Work with security rules

    If you are running a Firewall in Azure please verify there is a rule configured to allow inbound TCP port 1433 communication from public internet to the Azure VM.


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

  3. Saraswathi Devadula 4,605 Reputation points Microsoft External Staff Moderator
    2025-06-03T15:59:35.67+00:00

    Hi OnePage

    Following our discussion, you were unable to connect to the Azure SQL VM.

    We investigated and discovered that SQL VM traffic was routed through the Azure Firewall.

    After we added the 1433 as a source on the inbound NSG rule. But still unable to connect with error 18456. Later, we tried to create the new SQL VM with SQL server authentication enabled and successfully you were able to connect to the SQL VM.

    I hope this has been helpful!

    Your feedback is important so please take a moment to accept answers. If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    If this answers your query, do click Accept Answer and Upvote for was this answer helpful.
    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.