SQL SERVER – How to Create Linked Server to SQL Azure Database?

If you take the normal approach to create a linked server to SQL Azure Database, then you would end up in below error message.

SQL SERVER - How to Create Linked Server to SQL Azure Database? azure-ls-01

Here is the text of the error message

Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

Reference to database and/or server name in ‘sqlauthority.sys.sp_tables_rowset2’ is not supported in this version of SQL Server. (Microsoft SQL Server, Error: 40515)

SOLUTION

For me, here is the configuration in Azure

Server name – sqlauthority.database.windows.net
Database name – sqlauthority

SQL SERVER - How to Create Linked Server to SQL Azure Database? azure-ls-02

Here are the steps I have taken to create linked server. I went to new linked server and on “General”, I used below:

  • Linked Server (name): LinkedServerName
  • Provider: Microsoft OLE DB Provider for SQL Server
  • Product name: (blank)
  • Data Source: azure_db_server.database.windows.net
  • Provider string: (blank)
  • Location: (blank)
  • Catalog: database name in Azure

SQL SERVER - How to Create Linked Server to SQL Azure Database? azure-ls-03

Then on “Security” tab, I used below.

  • Be made using this security context
    • Remote login: azure-database-user-name
    • With password: password

SQL SERVER - How to Create Linked Server to SQL Azure Database? azure-ls-04

Once done, hit OK.

Here is the information via linked server

SQL SERVER - How to Create Linked Server to SQL Azure Database? azure-ls-05

This is same what we saw when we were directly connected. I hope this blog can help you in fixing linked server errors to SQL Azure Database. Let me know if you have ever faced the same situation before. I would love to know your feedback in the comments.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Linked Server, SQL Azure, SQL Error Messages, SQL Server
Previous Post
SQL SERVER – Remove Duplicate Chars From String – Part 2
Next Post
SQL SERVER – Convert Decimal to Time Format in String

Related Posts

7 Comments. Leave new

  • What If we have multiple Databases? In catalog section can we specify multiple Database names??

    Reply
    • I too am trying to configure a Linked Server from on-prem SQL Server and Azure with an Azure SQL Server that hosts multiple databases. I am using a SQL Login/User with SQL Authentication that has permissions in all of my Azure databases, and the same SQL login and password exist on the on-prem server. I am using the same data source and configuration you have above. I can successfully view and query one database, but no matter how I configure this I cannot both view and query multiple databases. Is it possible to create a linked server that references multiple catalogs?

      Reply
  • In Azure database , i dont see options for Server Objects, where we can create Linked Server, so far my understanding is The Azure SQL Database (Software as a service) does not have linked servers and the alternate is Cross-Database Queries, Please help
    https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/

    Reply
  • Is there a way to create this LinkedServerConnection from a traditional SQL Server to AzureSQLDatabase without using SQL Authenticated account? I am looking to leverage traditional ActiveDirectory account (or even a AzureActiveDirectory account).

    Reply
  • Paul Wichtendahl
    December 14, 2019 6:27 am

    Once again, your advice was FLAWLESS!

    Reply
  • John Blaylock
    May 6, 2020 8:59 pm

    can you create a linked server from an azure managed instance to an azure sql database\//

    Reply

Leave a Reply