Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multidacpac deployment on hosted agent 2017 #20

Open
sandorfr opened this issue Aug 22, 2017 · 7 comments
Open

Support multidacpac deployment on hosted agent 2017 #20

sandorfr opened this issue Aug 22, 2017 · 7 comments
Assignees
Milestone

Comments

@sandorfr
Copy link
Member

sandorfr commented Aug 22, 2017

Since the release of SQL Server 2017, sqlps is replaced by SqlServer powershell module which is a standalone package which can be installed with install-module command 🎉 . The even better news is that install-module is works just fine on current hosted agent images. So the following script just works:

Install-module -Name SqlServer -Scope CurrentUser -Force
Import-Module SqlServer 
Invoke-Sqlcmd -ServerInstance "IDontExist"

SSDT (sqlpackage) is also available on agents. It is also available as a standalone nuget package.

It means that we could add the dependencies automatically if not found and support any agent without any manual steps (as long as it as nuget tools and powershell gallery tools).

@sandorfr
Copy link
Member Author

@asiffermann I'd be happy to have your feedback on the recent changes I've made on that matter before I publish it :)

@sandorfr
Copy link
Member Author

Actually, we may want to move SQLServer/SQLPS and sqlpackage install to some tool installer task.

@asiffermann
Copy link
Member

@sandorfr your changes seems fair to me, but it would be better with a tool installer indeed.

I have to publish a new version of the task due to #25 with your recent changes, but it won't be a problem as all agents running our tasks at the moment should have SQLPackage and sqlps installed.

@sandorfr
Copy link
Member Author

sandorfr commented Jan 22, 2018

They have changed the nuget package for sqlpackage which is now there https://www.nuget.org/packages/Microsoft.SqlServer.DacFx.x64/

I was running into that problem : https://blogs.msdn.microsoft.com/azuresqldbsupport/2017/09/19/deployment-fails-with-unable-to-connect-to-master-or-target-server-mydb_svr-you-must-have-a-user-with-the-same-password-in-master-or-target-server-mydb-db/

And it seems the probleme is related to azure receiving updates and hosted agent having a by design outdated version of sql package.

It feels like a tool installer is now a must have.

@sandorfr
Copy link
Member Author

@sandorfr
Copy link
Member Author

sandorfr commented Jan 23, 2018

Currently the detection script picks an older version that the last one available (which should be 140 instead of 130): C:\Program Files (x86)\Microsoft SQL Server\140\Dac\bin\SqlPackage.exe

2017-12-12T12:30:38.6794755Z ##[debug]Sql Versions installed on machine BUILD-AGENT as read from registry: 110
2017-12-12T12:30:38.6794755Z ##[debug]Sql Version Specific Root Dir for version 110 as read from registry: C:\Program Files\Microsoft SQL Server\110\
2017-12-12T12:30:38.6794755Z ##[debug]Sql Version Specific Root Dir for version 110 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\110\
2017-12-12T12:30:38.6794755Z ##[debug]Dac Framework installed with SQL Version 110 found at C:\Program Files (x86)\Microsoft SQL Server\110\Dac\bin\SqlPackage.exe on machine BUILD-AGENT
2017-12-12T12:30:38.6794755Z ##[debug]Dac Framework (installed with DAC Framework Msi) found on machine BUILD-AGENT at C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe
2017-12-12T12:30:38.6794755Z ##[debug]Visual Studio versions found on machine BUILD-AGENT as read from registry: 15.0 14.0 12.0 11.0 10.0 9.0
2017-12-12T12:30:38.6794755Z ##[debug]Visual Studio install location: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\
2017-12-12T12:30:38.6794755Z ##[debug]Dac Framework installed with Visual Studio found at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\SqlPackage.exe on machine BUILD-AGENT
2017-12-12T12:30:38.6794755Z ##[debug]SqlPackage Path: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\SqlPackage.exe'
2017-12-12T12:30:38.6794755Z Deploying Version: 0.6.0.196638
2017-12-12T12:30:38.6951101Z ##[debug][CMD Call] Executing: & "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\SqlPackage.exe" /SourceFile:"C:\gl-vso-agent-core\_work\r14\a\Server - Develop CI\Packages\Database\bin\Release\SaintGobain.Glassol.Database.dacpac" /Action:Publish /TargetServerName:"sqlserverdh7ubgfiist5c.database.windows.net" /TargetDatabaseName:"IntDevApiDatabase" /TargetUser:"SqliAdmin" /TargetPassword:"********" /p:DropObjectsNotInSource=True /p:DoNotDropObjectTypes=users /p:ExcludeObjectTypes=RoleMembership;users /p:BlockOnPossibleDataLoss=False /p:BlockWhenDriftDetected=False /p:RegisterDataTierApplication=True 2>''
2017-12-12T12:30:43.2932553Z ##[debug][CMD Call] Executed
2017-12-12T12:30:43.3088793Z ##[debug]Publishing to database 'IntDevApiDatabase' on server 'sqlserverdh7ubgfiist5c.database.windows.net'.
2017-12-12T12:30:43.3088793Z ##[debug]Initializing deployment (Start)
2017-12-12T12:30:43.3088793Z ##[debug]Initializing deployment (Failed)
2017-12-12T12:30:43.3401301Z ##[error]*** Could not deploy package.
2017-12-12T12:30:43.3401301Z ##[debug]Processed: ##vso[task.logissue type=error]*** Could not deploy package.
2017-12-12T12:30:43.3401301Z ##[error]Unable to connect to master or target server 'IntDevApiDatabase'. You must have a user with the same password in master or target server 'IntDevApiDatabase'.

@sandorfr
Copy link
Member Author

sandorfr commented Jan 23, 2018

Oops the log was from our out of date agent which explains a lot. Which is the perfect illustration of the need of a tool installer especially since azure team expects it to be up to date at all times

@asiffermann asiffermann self-assigned this Mar 4, 2019
@asiffermann asiffermann added this to the 2.0.0 milestone Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants