Options

VSTF build and release confusion

Hi,

I'm having trouble working out how ReadyRoll will integrate with our VSTF build and release process - I'm totally new to ReadyRoll so hopefully it's my own inexperience which is the problem.

We currently have a build process that works fine and a release process that is creating a web application and an empty Azure SQL database (these are for running end to end and acceptance tests and will be taken down after testing).

The app and database do not exist until after the build process - what I'm having trouble with is that ReadyRoll appears to requires us to specify a target database in the build process (we are using the ReadyRoll nuget package) and this database will not actually exist until after the release process has run.

Am I missing something simple here or do we actually have to have a test database already up and running before the build runs?
Tagged:

Comments

  • Options
    Alex TAlex T Posts: 5 New member
    It looks like you're on the right track.

    You shouldn't need to specify the TargetDatabase build parameter, because this is only needed for generating the diff report and the patch script. These artifacts are useful for previewing what changes/scripts are going to be applied to a specific environment -- most users tend to choose Production as a target.

    As long as you run the steps that create your database before the Deploy ReadyRoll Database Package step in your release definition, everything should work just fine.

    See this article for more information.
    Software Engineer
    Redgate Software
  • Options
    Hi - This worked a treat to get the build working. We are now experiencing problems with the VSTS release Deploy ReadyRoll Database Package step.

    The parameter 'Target SQL Server Instance' is causing the process to error.
    The input box is asking for the fully qualified SQL server instance name.

    i.e. as an example this would be 'oursqlserver.database.windows.net'. When we put the fully qualified name in the ReadyRoll database deployment step fails with the error:
    2017-06-05T10:28:39.1015469Z Server name cannot be determined. It must appear as the first segment of the server's dns name (servername.database.windows.net). Some libraries do not send the server name, in which case the server name must be included as part of the user name (username@servername). In addition, if both formats are used, the server names must match.

    and the sqlcmd that produces this error is as follows:
    sqlcmd.exe -b -S "oursqlserver.database.windows.net" -v DatabaseName="ourdatabasename" ReleaseVersion="" DeployPath="D:\a\r1\a\.....\drop\ourdatabasename.Database\bin\Release\" ForceDeployWithoutBaseline="False" DefaultFilePrefix="ourdatabasename.Database" DefaultDataPath="" DefaultLogPath="" DefaultBackupPath="" -i "D:\a\r1\a\.....\drop\ourdatabasename.Database\bin\Release\ourdatabasename.Database_Package.sql" -U "adminusername"
    

    If we run sqlcmd ourselves with the above database server, database name and username (and add the password) we can connect and query the database fine.

    When we change the parameter 'Target SQL Server Instance' to the first part of our server name 'oursqlserver' (as the above error suggests we should?) we get the following error:
    Named Pipes Provider: Could not open a connection to SQL Server [53].
    ##[error]A deployment error occurred: Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
    ##[error]System.Management.Automation.ActionPreferenceStopException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

    and the sqlcmd that produces this error is as follows:
    sqlcmd.exe -b -S "oursqlserver" -v DatabaseName="ourdatabasename" ReleaseVersion="" DeployPath="D:\a\r1\a\.....\drop\ourdatabasename.Database\bin\Release\" ForceDeployWithoutBaseline="False" DefaultFilePrefix="ourdatabasename.Database" DefaultDataPath="" DefaultLogPath="" DefaultBackupPath="" -i "D:\a\r1\a\.....\drop\ourdatabasename.Database\bin\Release\ourdatabasename.Database_Package.sql" -U "adminusername"
    

    This will not connect to the database if we run sqlcmd with these shortened form of the server name.

    So - is there something obvious we are missing?

    Any help on solving this would be most appreciated.



  • Options
    Alex TAlex T Posts: 5 New member
    Glad to hear you got the build part working!

    There's something you're missing, but it isn't obvious. When connecting to Azure, you need to specify the username in the format username@servername (the error message suggests this, but it's not very clear). You must have missed this bit of the documentation article I shared in my previous message:
    Azure SQL username
    If deploying to a database hosted on an Microsoft Azure SQL instance, be sure to include the server name as part of the Database Username field, e.g. myusername@myazureinstance.database.windows.net

    In your example, this would be: adminusername@oursqlserver.database.windows.net
    Software Engineer
    Redgate Software
Sign In or Register to comment.