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 24.1K Views
Copper Contributor
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
Copper Contributor

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.

 

Copper Contributor

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).

Version history
Last update:
‎Mar 13 2019 06:48 PM
Updated by: