Visual Studio - Azure SQL Connection Error - visual-studio

I am able to add an ADO.NET connection to Azure SQL and test the connection successfully. However, when I try to execute a task (Execute SQL Task error in this example), I get the following error:
[Execute SQL Task] Error: Failed to acquire connection "". Connection may not be configured correctly or you may not have the right permissions on this connection.
My firewall settings are all good on the Azure portal so I don't think it's that.
Before we moved to MFA, I was using Integrated Authentication and had no issues. I am wondering how/why I can connect via connection managers but not via tasks? Are there other tasks I should be using instead? If so, why would the tasks work for Integrated Authentication and not MFA?
Any help would be greatly appreciated.

Related

The underlying provider failed on Open. Remote Debbuging with Azure to VS2019

I am remotely debugging my application with azure and VS2019 and it works fine until I have to connect to the database.
Then I get the following error. "The underlying provider failed on Open."
On the other hand, if I debug locally everything works correctly.
Do you have to activate any permission in Azure or in the project config so that the database can be accessed remotely?
Right after the connection string I have put the following.
_context.Database.Connection.Open ();
So it returns the following error to me:
"Unable to connect to any of the specified MySQL hosts".
All this locally does not happen to me. Only when trying to debug remotely.
According to your description, we can ensure that the remote debug function of vs2019 is normal. An error is reported in this _context.Database.Connection.Open (); code. Obviously, the program cannot connect to the mysql database server.
Troubleshooting:
First make sure that your mysql database server can be accessed using tools (such as Mysql Workbench).
Using tools to ensure that the database is accessible is to ensure that the firewall of your database server is open (mysql in azure or other server).
Check the connectionstring of mysql in the released program. According to your error message, it is likely that the connection string is used incorrectly.

Can't access Azure SQL database with Visual Studio but can with SSMS

I'm trying to connect to an SQL database hosted on Azure from a function app I'm building in Visual Studio but I'm getting the following 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 - An attempt was made to access a socket in a way
forbidden by its access permissions.)
I can connect from the same PC using SSMS without a problem. I've tried connecting to the database using data connections in server explorer in VS but I'm getting the same error. If I connect to Azure with my account in server explorer it shows me a selection of services including SQL databases but there are none listed underneath although my account does have access to the database.
Are there any hidden gotchas I'm missing or settings within VS? I've also tried adding my client IP in the firewall settings but that didn't make a difference either.
After doing some more testing it turned out to be the client firewall that was blocking VS and VS Code from connecting to Azure SQL. It seems there was already an exception for SSMS.
The error message states "Verify that the instance name is correct"
It could be that the SSMS is automatically creating a fully qualified name once you say that it is an azure database.
If you use the short name from Visual Studio, then you cannot connect to the SQL server.
For example "myserver.database.windows.net" versus "myserver".

Local Db failure on initialization of template

I'm trying to setup a startup template to play around with boilerplate and see what it could potentially offer and I'm running into issues setting up my local database.
I've tried the core startup template download as well as MVC 5 and they've both given me the same issue so far. I'll open up the solution in VS 2017, clean the solution, rebuild, enter Package Manager Console and execute Update-Database on the EntityFramework project and I get this error on both projects,
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:2,State:0,Class:20
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)
I'm having a hard time understanding what this might be indicating. I'm pretty sure I've been able to use my local db in other projects recently.
You need to set up an empty database and provide a valid connection string in appsettings.json.
You can use Microsoft's SQL Server.

SharePoint 2013 - Configuring Workflow Manager

I am attempting to configure the workflow manager. I have a SQL DB and SP server. In WF Manager Configuration Wizard, when I enter the name of my SQL DB into the SQL server instance field and test the connection, I receive a check mark. However, if I check the "Enable SSL connection with SQL Server instance", and test the connection message, I receive an error message "Failure in connecting to SQL Server".
What could cause the test connection to fail when I enable SSL connection? As long as I do not enable SSL, the test connection pass.
I have a very simple environment. Nothing complex. 1 - SQL Server and 1 SP server with SP Standard 2013 installed.
Please help.
Make sure that your SQL Server has the login for the account under which you are running Workflow Manager Configuration Wizard.
Step 1
Go into SQL Management Studio and add a new login for the account running Workflow Manager Configuration.
Step 2
Enter your connection string in the Workflow Manager Configuration and test it to see if it works.
This might look simple in retrospective, but took me a day to figure out. I wish the error message was more elaborate than a useless "Failure in connecting to SQL Server".
I got the same issue and it works when I put the full name of the SQL

Unable to start SQL server Agents

been trying to configure an ADO.NET connection for my Visual Studio application but I am running into issues and having no luck at all troubleshooting them. The major error that I run into is:
A network-related or instance-specific error occurred while establishing a connection to SQL server. The server was not found or not accessible. Verify the instance name is correct and that SQL server is configured to allow remote connections (Error 40: Could not open connection to the SQL server)
The steps I undertook to troubleshoot this are:
1. Open up Sql server configuration manager and under the SQL Server Network Configuration, Protocols for MSSQLSERVER,SQLExpress, SQL server 2008 connection string data source I enable each of the protocol names (Shared memory, Named pipes,TCP/IP,VIA)
As instructed I stop the SQL server services first under the SQL server services nodes.
Now I click start, MSSQL server service starts but both SQL Server 2008 and SQLEXPRESS agents do not. Stating the following:
The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details
This might just be the problem as when I attempt to create the connection string , the server name specified is MYWORLD/SQL SERVER 2008. Since the SQL server 2008 agent service refuses to start, the connection fails, leading to the first error message.
Does anybody have any leads on this and can let me know the necessary steps to mitigate this.
The SQL Browser service must be running to connect to a named instance.
Use SQL Servr Configuration Manager under Configuration Tools under Microsot SQL Server 2008 to assign the logon accounts for each service you want to run. Do NOT use any other method to assign user accounts because the correct rights will not be enabled.

Resources