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.
Can someone advise is there any other configuration I should do.
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
Related
I have a setup where the connection string of my .NET application is configured at the app service level and the database used in it is present in an Azure SQL VM
I see the following error, while accessing my Web APIs in the app service
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 - Access is denied.
However, I’m able to connect to the database directly on my local system using SSMS with my organisation’s VPN
I’m struggling to find the right resource, appreciate if you someone can help me with steps to fix it
i just have the beginner level knowledge on Azure platform
I tried to reproduce the same in my environment I got the same error like below.
To resolve this issue i have removed private access and tried and then added new private access its work successfully.
Check the public access in selected network with firewall rule and allow exception as below.
And, when I remove this private endpoint and try to add new private access i can able to connect with my sql server.
Check this connectivity as below.
My azuresql,database server connected successfully.
Note: This error may occur in multiple ways if are not enable sql services and in tcp/Ip If any of the protocols are disabled or if Remote Connection Permission is disable error may occur for this please refer the below documents.
Reference:
Microsoft SQL Server Error 2 Cannot Connect to Local: How to Solve? (systoolsgroup.com)
Resolving could not open a connection to SQL Server errors (mssqltips.com)
I created a new Azure SQL Managed Instance and obtained the connection string from the Azure Portal. However, I am unable to connect to the server from SQL Server Management Studio. The connection hangs and times out with a network error.
You need to configure the public endpoint and ensure you're using the public connection string, including port 3342 at the end of it.
https://www.jamesserra.com/archive/2020/04/accessing-managed-instance-via-ssms/
I've built a Windows container with my app inside and ran it locally. The app in the container connects to an Azure SQL Database, using the domain name from the connection string. SQL Server is configured to accept clients from any IP and from Azure Services.
Everything works fine locally. But when I run my container in Azure Container Instances, I get the following standard 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.)
You need to create a managed identity https://learn.microsoft.com/en-us/azure/container-instances/container-instances-managed-identity and grant that identity permission to the SQL database.
You can then use the Microsoft.Azure.Services.AppAuthentication library to get an access token and use it during authentication. This is only available in dotnetcore 2.2 and .net 4.6 and above.
string connectionString = "Data Source=<AZURE-SQL-SERVERNAME>; Initial Catalog=<DATABASE>;";
SqlConnection conn = new SqlConnection(connectionString);
conn.AccessToken = (new AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").Result;
conn.Open();
More info can be found in the below links. None of them are explicitly for ACI but it should be basically the same from a code perspective once you have created the MSI.
https://learn.microsoft.com/en-us/azure/key-vault/service-to-service-authentication
https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-sql
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi
I've experienced a similar issue with a Windows container in ACI trying to connect to an Azure SQL database. For some reason, DNS was not working inside the container. I could not resolve any public DNS names. Inside the container, DNS was pointed to a 10.x.x.x address. I never set this as part of the image build so I assume ACI is setting this as part of DHCP.
To fix this I ran the following as part of my PowerShell entrypoint script:
$nic = Get-NetAdapter
Set-DnsClientServerAddress -InterfaceIndex $nic.IfIndex -ServerAddresses ('1.1.1.1','8.8.8.8')
I am hosting a bunch of micro-services and bot apps using Docker, and Azure virtual machines. There´s also a dockerized SQL Server 2017 instance in the stack, which I would like to migrate to Azure SQL. I am out of luck when trying to configure the source database in an Azure Database Migration project...
I tried to specify the service endpoint including the exposed port (since the dockerized SQL Server container´s public port is not 1433). I can connect to the SQL Server instance using SSMS from my workstation with no error, so connectivity is not the problem at all; does the Azure Database Migration require port 1433, or if not, how can I correctly specify a different port?
These are the error details I got from source details configuration in the Azure portal:
Error Type
Failed to connect, please check error details
Error Detail
Collector 'Microsoft.SqlServer.Advisor.SqlQueries.Contracts.Models.IQueryServerProperties' failed to collect data. 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)
The parameter is incorrect
The source database configuration wizard is not very clear about the format of the remote server´s DNS name. Just specifying the fully qualified DNS name and port is not enough; it must contain the server´s instance name as well.
Wrong:
<DNS-name>,<port>
Correct:
<DNS-name>\<INSTANCENAME>,<port>
My azure application successfully running with azure sql database,but now i want to run Cloud application with my own database servers because of their data security. for this, we can establish the local database connection from our own systems with cloud application and connect to my database perfectly with following steps using below link,
http://www.codeproject.com/Articles/261063/Azure-Virtual-Network-Connecting-Local-Database
After this i deployed my application in to azure and it deployed without any error.but when i try to run my cloud application using cloud url like xxx.cloudapp.net getting an error like
"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 - The requested name is valid, but no data of the requested type was found.)".
Please give some suggestions why am getting this error.
Thanks,
PCSSCP.
Try connecting using SQL Management from another machine outside of your network. I believe that there is no problem with publication in Azure Cloud Service, but a connectivity problem with your SQL server.
Arthur Oliveira
You have to remote to VM and check SQL Server port is opened or not, the same with SQL Server machine. I used to connect local DB with cloud based application.
This is an intermittent issue with the SQL Server.
Check this link if it helps,
IntermittentSQLServerIssue