Share via

Azure Database Link Server

Handian Sudianto 7,026 Reputation points
2026-04-23T12:34:32.5533333+00:00

On the on-prem SQL server we can sue link server to connect to the table in different database. Can we make simillar way to connecting between table on the on-prem to azure sql db?

Azure SQL Database
0 comments No comments

Answer accepted by question author

  1. Manoj Kumar Boyini 13,930 Reputation points Microsoft External Staff Moderator
    2026-04-23T23:00:32.74+00:00

    Hi @Handian Sudianto

    Azure SQL Database does not support creating linked servers internally, so you cannot configure a linked server from within Azure SQL Database like you would in SQL Server.

    However, you can create a linked server on your on-premises SQL Server that points to Azure SQL Database using the Microsoft OLE DB Driver for SQL Server. This allows you to query Azure SQL Database using four-part naming from your on-prem environment.

    That said, there are some important limitations to be aware of:

    • Distributed transactions (MSDTC) are not supported
    • Performance may be impacted due to network latency and limited query pushdown
    • Some T-SQL behaviors may differ compared to SQL Server

    If your requirement is a full linked-server experience similar to SQL Server, Azure SQL Managed Instance is the recommended option, as it supports linked servers natively.

    If your goal is data integration or movement rather than real-time querying, Azure-native approaches (such as data pipelines or synchronization) are generally more reliable than linked servers.

    Hope this helps, Please let us know if you have any questions and concerns.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Alberto Morillo 35,501 Reputation points MVP Volunteer Moderator
    2026-04-23T14:56:00.6133333+00:00

    You cannot create a linked server on Azure SQL Database, but you can create a linked server on your on-premises SQL Server that point to an Azure SQL database. The performance may not be as good as you may expect.

    However, Azure SQL Managed Instance does support linked server. You can create a linked server on Azure SQL Managed Instance to the following Supported targets only: SQL Managed Instance, SQL Database, Azure Synapse SQL serverless and dedicated pools, and SQL Server instance.

    0 comments No comments

  2. Q&A Assist
    2026-04-23T12:34:46.6733333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Yes. An on-premises SQL Server instance can use a linked server to connect to an Azure SQL Database and query its tables much like other remote databases.

    Key points from the context:

    • Linked servers are a feature of SQL Server (the box product) and Azure SQL Managed Instance, not of Azure SQL Database itself. That means the linked server must be created on the on-prem SQL Server, pointing to Azure SQL Database as the remote data source.
    • Every Azure SQL database (except the logical server’s master database) can be added as an individual linked server and then used directly in database applications as any other database.

    Example pattern to configure a linked server from on-prem SQL Server to Azure SQL Database:

    1. On the on-prem SQL Server, create the linked server:
         EXECUTE sp_addlinkedserver
             @server   = 'LinkedServerName',
             @srvproduct = '',
             @provider  = 'sqlncli',
             @datasrc   = 'ServerName.database.windows.net',
             @location  = '',
             @provstr   = '',
             @catalog   = 'DatabaseName';
      
    2. Configure login mapping and options:
         EXECUTE sp_addlinkedsrvlogin
             @rmtsrvname  = 'LinkedServerName',
             @useself     = 'false',
             @rmtuser     = 'LoginName',
             @rmtpassword = '<password>';
         
         EXECUTE sp_serveroption 'LinkedServerName', 'rpc out', true;
      
    3. Query Azure SQL Database tables from on-prem using four-part names or EXECUTE ... AT:
         SELECT *
         FROM LinkedServerName.DatabaseName.SchemaName.TableName;
         
         EXECUTE ('INSERT INTO SchemaName.TableName VALUES(1)') AT LinkedServerName;
      

    This provides a similar experience to querying another on-prem database via linked server, but the remote endpoint is Azure SQL Database.

    Note: Linked servers themselves are not available inside Azure SQL Database; they are configured on SQL Server or Azure SQL Managed Instance.


    References:

Your answer

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