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'

Published Mar 13 2019 06:48 PM 15.2K Views
Not applicable
First published on MSDN on Sep 19, 2017
This will be a very short post to address what appears to be a slight trend in support at the moment.

When attempting a deployment fails with an exception, attempting a deployment of the dacpac for the database via sqlpackage.exe also fails with the error:
'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'
This occurs when the deployment is to a recently created database server, deployments to older database servers do not result in the error

Resolution:

There seem to be a few reasons for this error, which is a little misleading

If your SSDT is not up to date you can see this error, this is because the latest compatibility level for Azure DB is 140, and the older sqlpackage.exe does not recognize this it works with compatibility levels up to 130. To resolve this issue you can get the latest version (17.3 version) from here .

You can also get this error if your client computer fails to pass the firewall rules for the server.
2 Comments
Occasional Visitor

Hi, I am also facing a similar kind of issue and the following are the steps I have followed.

1. I have VS 2019 database project "TestDBProject" in which SQL objects Tables/Stored Procedure etc. creation scripts available. 

2. Trying to deploy the TestDBProject.dacpac file of the above project into Azure SQL Database using "Azure SQL Database Deployment" task in VSTS Release pipeline which is throwing the following error.

Unable to connect to master or target server 'TestDB'. You must have a user with the same password in master or target server 'TestDB'.

3. So I have tried updating "TestDBProject.sqlproj"(by opening it in notepad) the DSP with the below 2 options and created the respective "TestDBProject.dacpac" file by building the project.

<DSP>Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider</DSP>

<DSP>Microsoft.Data.Tools.Schema.Sql.Sql140DatabaseSchemaProvider</DSP>

4. I even added the following MSBuild Arguments in the Build pipeline "Visual Studio Build" Task, but no use still getting above same error.

/p:AllowIncompatiblePlatform=true

/p:DSP=Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider

 

Can you pl. let me know what am I missing or any suggestions are appreciable.

 

Occasional Visitor

I had a similar problem. I was able to fix by upgrading the Microsoft.SqlServer.DacFx.x64 package from 140.3745.1 to 150.4897.1 (latest stable).

%3CLINGO-SUB%20id%3D%22lingo-sub-368944%22%20slang%3D%22en-US%22%3EDeployment%20fails%20with%20'Unable%20to%20connect%20to%20master%20or%20target%20server%20'mydb_svr'.%20You%20must%20have%20a%20user%20with%20the%20same%20password%20in%20master%20or%20target%20server%20'mydb-db'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-368944%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Sep%2019%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20This%20will%20be%20a%20very%20short%20post%20to%20address%20what%20appears%20to%20be%20a%20slight%20trend%20in%20support%20at%20the%20moment.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20When%20attempting%20a%20deployment%20fails%20with%20an%20exception%2C%20attempting%20a%20deployment%20of%20the%20dacpac%20for%20the%20database%20via%20sqlpackage.exe%20also%20fails%20with%20the%20error%3A%20%3CBR%20%2F%3E%20%3CEM%3E%20'Unable%20to%20connect%20to%20master%20or%20target%20server%20'mydb_svr'.%20You%20must%20have%20a%20user%20with%20the%20same%20password%20in%20master%20or%20target%20server%20'mydb-db'%20%3C%2FEM%3E%20%3CBR%20%2F%3E%20This%20occurs%20when%20the%20deployment%20is%20to%20a%20recently%20created%20database%20server%2C%20deployments%20to%20older%20database%20servers%20do%20not%26nbsp%3Bresult%20in%20the%20error%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Resolution%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20There%20seem%20to%20be%20a%20few%20reasons%20for%20this%20error%2C%20which%20is%20a%20little%20misleading%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20your%20SSDT%20is%20not%20up%20to%20date%20you%20can%20see%20this%20error%2C%20this%20is%20because%20the%20latest%20compatibility%20level%20for%20Azure%20DB%20is%20140%2C%20and%20the%20older%20sqlpackage.exe%20does%20not%20recognize%20this%20it%20works%20with%20compatibility%20levels%26nbsp%3Bup%20to%20130.%26nbsp%3BTo%20resolve%20this%20issue%20you%20can%20get%20the%20latest%20version%20(17.3%20version)%20from%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fssdt%2Fdownload-sql-server-data-tools-ssdt%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20here%20%3C%2FA%3E%20.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20You%20can%20also%20get%20this%20error%20if%20your%20client%20computer%20fails%20to%20pass%20the%20firewall%20rules%20for%20the%20server.%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-368944%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Sep%2019%2C%202017%20This%20will%20be%20a%20very%20short%20post%20to%20address%20what%20appears%20to%20be%20a%20slight%20trend%20in%20support%20at%20the%20moment.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-368944%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Edacpac%20sqlpackage%20exe%20password%20azure%20deployment%20sitecore%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1901282%22%20slang%3D%22en-US%22%3ERe%3A%20Deployment%20fails%20with%20'Unable%20to%20connect%20to%20master%20or%20target%20server%20'mydb_svr'.%20You%20must%20have%20a%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1901282%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20am%20also%20facing%20a%20similar%20kind%20of%20issue%20and%20the%20following%20are%20the%20steps%20I%20have%20followed.%3C%2FP%3E%3CP%3E1.%20I%20have%20VS%202019%20database%20project%20%22TestDBProject%22%20in%20which%20SQL%20objects%20Tables%2FStored%20Procedure%20etc.%20creation%20scripts%20available.%26nbsp%3B%3C%2FP%3E%3CP%3E2.%20Trying%20to%20deploy%20the%20TestDBProject.dacpac%20file%20of%20the%20above%20project%20into%20Azure%20SQL%20Database%20using%20%22Azure%20SQL%20Database%20Deployment%22%20task%20in%20VSTS%20Release%20pipeline%20which%20is%20throwing%20the%20following%20error.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CEM%3EUnable%20to%20connect%20to%20master%20or%20target%20server%20'TestDB'.%20You%20must%20have%20a%20user%20with%20the%20same%20password%20in%20master%20or%20target%20server%20'TestDB'.%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E3.%20So%20I%20have%20tried%20updating%20%22TestDBProject.sqlproj%22(by%20opening%20it%20in%20notepad)%20the%20DSP%20with%20the%20below%202%20options%20and%20created%20the%20respective%20%22TestDBProject.dacpac%22%20file%20by%20building%20the%20project.%3C%2FP%3E%3CP%3E%3CDSP%3EMicrosoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider%3C%2FDSP%3E%3C%2FP%3E%3CP%3E%3CDSP%3EMicrosoft.Data.Tools.Schema.Sql.Sql140DatabaseSchemaProvider%3C%2FDSP%3E%3C%2FP%3E%3CP%3E4.%20I%20even%20added%20the%20following%20MSBuild%20Arguments%20in%20the%20Build%20pipeline%20%22Visual%20Studio%20Build%22%20Task%2C%20but%20no%20use%20still%20getting%20above%20same%20error.%3C%2FP%3E%3CP%3E%2Fp%3AAllowIncompatiblePlatform%3Dtrue%3C%2FP%3E%3CP%3E%2Fp%3ADSP%3DMicrosoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20pl.%20let%20me%20know%20what%20am%20I%20missing%20or%20any%20suggestions%20are%20appreciable.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2018439%22%20slang%3D%22en-US%22%3ERe%3A%20Deployment%20fails%20with%20'Unable%20to%20connect%20to%20master%20or%20target%20server%20'mydb_svr'.%20You%20must%20have%20a%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2018439%22%20slang%3D%22en-US%22%3E%3CP%3EI%20had%20a%20similar%20problem.%20I%20was%20able%20to%20fix%20by%20upgrading%20the%20Microsoft.SqlServer.DacFx.x64%20package%20from%20140.3745.1%20to%20150.4897.1%20(latest%20stable).%3C%2FP%3E%3C%2FLINGO-BODY%3E
Version history
Last update:
‎Mar 13 2019 06:48 PM
Updated by: