Linked server between a SQL Managed Instance and an Azure VM-based SQL Server in different virtual networks?

Elliot Stansfield 1 Reputation point
2023-09-08T15:05:41.6933333+00:00

We have a requirement to set up a linked server connection from our Azure SQL Managed Instance which sits in VNET A to a 'regular' SQL Server installation running on an Azure VM, which sits in VNET B (which is in a different region).

Despite various changes made to NSG's on both sides to allow the necessary connections, it does not work, with a generic connection error shown when attempting to setup the connection in SSMS (despite trying various combinations of settings and connection strings). Weirdly though, I can set up the linked server connection the other way without any issues (i.e. from the Azure VM-based SQL Server TO the Managed Instance), just not the other way around.

Is this even a feasible scenario? And if so, what are the specific steps to get this working?

SQL Server on Azure Virtual Machines
Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 18,696 Reputation points Microsoft Employee
    2023-09-08T21:39:38.88+00:00

    @Elliot Stansfield Thank you for reaching out.

    Yes, it is possible to set up a linked server connection from your Azure SQL Managed Instance to a SQL Server installation running on an Azure VM in a different VNET. Please check if both vnet are peered. The Windows firewall on the VM side should allow inbound traffic from SQL MI on port 1433.

    Regards,

    Oury

    0 comments No comments

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.