How to Connect Amazon RDS SQL from Azure Devops for Database Automation

Viewed 1294

I am trying to automate build deployment process and part of which is upgrading the database with each release. Database hosted on Amazon RDS SQL Server. My RDS database is available for public access as well, am able to connect from any where using management studio. However, server is not accessible at all from Azure Devops Pipeline.

Output from my Build agent task

2 Answers

Have you looked at the AWS Toolkit for Azure DevOps? That lets you connect to AWS resources from Azure DevOps. You also need to make sure your firewall on the instance allows connections from Azure DevOps. More on this in the documentation.

The issue was from the task Deploy database DACPAC using a DAC Publish Profile you used in azure pipeline.

I looked through the source code of this task, and found the error server not exist came from here when ping the sqlserver. If credentials are needed to access the server master database, the code will failed.

And this task is unable to use sql server username and password. There are open issue about this. See issue here

As a workaround, you use run the sqlpackage.exe command directly in the Command line task to deploy the database: For example: run below line script in Command line task. See here for more information.

"C:\Program Files\Microsoft SQL Server\150\DAC\bin\sqlpackage.exe" /Action:Publish /SourceFile:[path to dacpac] /Profile:[path to publish profile]

The sqlpackage.exe can be found in path C:\Program Files\Microsoft SQL Server\150\DAC\bin\sqlpackage.exe, if you are using microsoft hosted agent.

Check here to learn more about sqlpackage command.

Check this open issue regarding this server not exist error.

Related