how to connect SQL Azure using local ssms? - sql-server

This may be a duplicate question, but i tried all way to connect the SQL Azure database from my local SSMS.
I have created Azure database in cloud and added my system IP in firewall configuration section, As I am on being corporate network and trying to connect azure database from my local ssms then i am 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)"

You need to add your IP in Azure as an allowed IP address.
Go to your database in the Azure portal, select configure -> Add to the allowed ip addresses.
Then connect to < Database name >.database.windows.net

Related

Accessing SQL Server from Azure DevOps Pipeline

Problem
I have setup an Azure Pipeline, and the problem I have is that during the Test Assemblies part of the Pipeline it is failing as it can't resolve the connection string/find my SQL Server.
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception: The network path was not found
In this scenario, I want to avoid creating a mock and ideally have the code directly communicate with SQL Server.
The SQL Server is sat on an Azure VM, so it's not a 'Azure SQL Database' service.
What I've Tried
I have opened the ports on the Azure VM to allow traffic from all regions/IP ranges used by Azure DevOps (I have found online that this is required). I have also tried pointing the connection string inside the Pipeline 'Test Assemblies' to a different (on-premise) windows server which holds an instance of SQL Server, but it is still not able to find/connect to SQL.
When connecting to SQL from my local (both the Azure VM and on-premise server) I can connect. We also have a few other services using the SQL Server sat on the Azure VM, so I am confident that the connectivity issue is with connecting from an Azure Pipeline.
Has anyone had this issue before?
Update
I have updated the connection string to directly refer to the port i.e.
**.***.**.***,1433
And the error message has now changed to:
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 wait operation timed out.) ---> System.ComponentModel.Win32Exception: The wait operation timed out
I now have it working.
After having the Azure DevOps region changed from West Europe to UK South, my DevOps can now communicate with SQL Server on my VM (with the required IP addresses white listed as per Leo Liu-MSFT's comment).

Microsoft SQL Server Management Studio - cannot create DB engine

I just installed Microsoft SQL Server Management Studio 17.2. I am trying to create a DB Engine on my local computer. My goal is to have a local demo database which I can create and modify tables.
I followed basic articles in the web saying that I only need to write my computer name as a server name and use windows authentication.
I am constantly getting this error:
TITLE: Connect to Server
Cannot connect to f.
ADDITIONAL INFORMATION:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)
The network path was not found
So to repeat again - my goal is only to be able to create database with random data. I need it for demo purposes.

SSRS not connecting to Azure SQL

We have our SSRS servers, on-premise. When trying to connect to the Azure SQL DB, it is throwing the following error when not using the port number 1433:
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: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server)
When using the port 1433, the same error is coming only instead of Named Pipes it says TCP.
What to do? I have already added the SSRS IP to the Azure SQL DB firewall and have checked the connection string is also perfect. Since Auidting is on, we are also using 'secure' in the connection URL of the server.

Unable to connect AWS RDS SQL Server

I have created a SQL Server Express instance on RDS. I have also created a security group and enabled SQL Server port range 1433 to everyone. I have also selected Yes for Publicly Accessible.
When I try to connect from the Management Studio, I do specify server name as endpoint of the instance including port number. I did specify the master username and master password with authentication type as SQL Server authentication.
I do get this error when connecting:
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) (Microsoft SQL Server, Error: 87)
When I try to see the RDS instance log I see below messages.
2016-12-01 22:31:19.65 Logon Login failed for user 'sa'. Reason: Could not find a login matching the name provided. [CLIENT: 123.249.0.134]
SA is not a possible login, it is disabled in RDS e.g. sysadmin does not exist, nor does the SQL Agent.
Use security groups to control what IP addresses or EC2 instances can connect to your databases on a DB instance. When you first create a DB instance, its firewall prevents any database access except through rules specified by an associated security group.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.html

Local IIS Web server cannot connect to SQL Server

When I use the local IIS Web server, my ASP.NET MVC application is unable to connect to SQL Server. The database is on another server. However, if I use the Visual Studio Development Server, it works just fine.
Anyone know what settings I'm missing? Should something change in my Web.config?
Yes, TCP/IP is enabled on SQL Server.
Here is the error I get -
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:
Named Pipes Provider, error: 40 - Could not open a connection to SQL
Server)
Here is my connection string -
connectionString="
SERVER=servername;
Initial Catalog=dbname;
User ID=userid;
Password=passwd"
providerName="System.Data.SqlClient"
I think you need to use IP address to connect remote database something like SERVER=59.230.212.12 in connection string. Try to connect database in management studio from where your IIS is installed . then use same setting in connection string .

Resources