1
votes

I have a classic pipeline that creates dacpac file from the git SQL database project. Using dacpac file as an input I've created a release pipeline(classic). In that release pipeline, I mention server name, user id, password.

enter image description here

When i run it, its given me error,

2021-05-03T12:24:22.1809539Z *** Could not deploy package.
2021-05-03T12:24:22.1810872Z Unable to connect to target server 'MyServerIP'. Please verify the connection information such as the server name, login credentials, and firewall rules for the target server.
2021-05-03T12:24:22.1812328Z 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)
2021-05-03T12:24:22.1815108Z The network path was not found
2021-05-03T12:24:22.3850691Z ##[error]Publishing to database 'MyProjectName' on server '172.16.192.71'.
Initializing deployment (Start)
Initializing deployment (Failed)

When I told to my client open port 1433 and change firewall rule for sql server, he denied and told me you connect database server using virtual private network VNet. He given me access of vnet. He not ready to expose his database server through public port number. He told me create net connection then access database. Now i'm confuse how to connect database using vpn in database pipeline so i can deploy my dacpac file. If any other solution please welcome.

1
Your deployment agent needs to be running on a machine that's either part of that virtual network or otherwise peered to it. Basically, a network route has to exist. If your agent doesn't have a network route, you'll need do something to create one. - Daniel Mann
That's my question how to connect with sql server machine in pipeline. - Shri Samarth
You don't do it in the pipeline. It's a networking concern. If you're using a self-hosted agent, the network configuration for that machine will have to be updated. That's going to differ depending on whether it's an Azure VM, a machine you have configured on-prem, and so on. If you're using the Microsoft hosted agent, you can't change the networking. - Daniel Mann
@DanielMann Thanks a lot. I configure a self-hosted agent on-premise VM where our SQL server exists. So yeah it's worked now. Thanks again. - Shri Samarth

1 Answers

1
votes

Thanks for Daniel Mann's help and glad to hear that you resolved it. I just help you post it as answer to end this question.

Solution:

  • You configure a self-hosted agent on-premise VM where your SQL server exists. And it works now.

This can be beneficial to other community members.