We are starting the build and testing process at TFS Online. This works great until we try to connect to an external service. In our case, the SQL database.
The discussion that we should mock this is not very useful in this case, because we must do it now.
We also tried just plain ping, but even this does not work:
Test-Connection "172.217.18.100"
Thus, it seems that most of the external IP addresses / ports / etc. can be blocked? Is there any way to open this? If so, how?
I canβt imagine that we are the first to try to do something like this? Downloading something from a website, creating REST, etc.? It must be possible somehow, no?
Update 1:
We had a slightly more detailed question about this issue here , but he decided that it was a more general problem.
Error message when connecting to Azure SQL
System.Data.SqlClient.SqlException: 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)`
But part of the Named Pipes provider has gaps. You also receive this message locally if you try to connect to an IP address that does not exist.
We access Azure SQL from our C # NUnit tests.
Update 2:
We tested the idea with @ starain-MSFT and installed the Azure SQL Execute Query step / task. The installation works fine, but the component seems to be missing. See the figure below.
No agent can be found with the following features: azureps, sqlps, npm, node.js, msbuild, visualstudio, vstest
Based on the installed applications list, I assume these are azureps.
Solution (partially):
Good, so we went down the wrong route. The problem is not the firewall (or any firewalls). The problem is that our app.config file did not have the correct settings. We had the same setup for our App.config files inside unit tests as for our Web.config files. Each of them had App.Debug.config and an attached file App.Release.config. Although this worked fine for web applications, it clearly did not work for our unit tests.
We are still looking for a good solution here. I found this solution on how to add the conversion task inside Visual Studio , but this is not quite what we are looking for, because we do not need to convert locally, but only in Visual Studio groups.
app.config Convert Inside Visual Studio Commands
So, I think we finally got it. With ConfigTransform, we can now convert our app.config files during the build process.