DrJohnT / AzureDevOpsExtensionsForSqlServer

Microsoft SQL Server deployment extensions for Azure DevOps Pipelines
MIT License
21 stars 14 forks source link

Can't deploy database when not having PING access to target server #3

Closed NowinskiK closed 5 years ago

NowinskiK commented 5 years ago

I have access to target server: test-netconnection server -port 1433 but can't do a PING. In that scenario I'm getting the following error:

Error: Server '10.xx.xx.xx,1433' does not exist!

due to the following line of code: if (!(Ping-SqlServer -Server $Server)) { throw "Server '$Server' does not exist!";

I'm not sure if testing for the existence of server via PING is the best idea. Could you make this block optional?

DrJohnT commented 5 years ago

Hey Kamil, glad you are checking out my code.

Actually, ping is just the name of the function. It is not actually using ping under the hood, but attempting to connect to the SqlServer instance using the SMO library.

Take a look at Ping-SqlServer to see what it is doing.

So there must be a problem with your server access if Ping-SqlServer fail - which is what I am testing for.

As 1433 is the default port, no need to specify in your server name passed to the module.

Best regards,

John