Search code examples
azureazure-cognitive-searchazure-sql-managed-instance

Unable to connect Azure SQL Managed Instance datasource from Azure Search Service


I'm trying to use Azure SQL Managed Instance server (with public endpoint disabled) as datasource for Azure Search Service indexer. When I try to create indexer in Azure Search, getting below error.

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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

Below is the connectionstring I used for Azure Search datasource.

Server=tcp:mymanagedinstance.database.windows.net,1433;Database=dbname;User Id=username;Password=password

I have added below inbound rules in SQL managed instance subnet's NSG. But still I'm unable to connect to managed instance from Azure Search.

enter image description here

Can someone advise is there any other configuration I should do.


Solution

  • I believe you do have to have the public endpoint enabled to index your SQL data via Azure Search. You should be able to enable the public endpoint to only allow "Azure Services" though. See below documentation for screenshots/more context.

    "As noted in Connecting Azure SQL Database to Azure Cognitive Search using indexers, creating indexers against SQL Managed Instances is supported by Azure Cognitive Search through the public endpoint."

    https://learn.microsoft.com/en-us/azure/search/search-howto-connecting-azure-sql-mi-to-azure-search-using-indexers