Ssdt Failing to Publish: "Unable to Connect to Master or Target Server"

SSDT failing to publish: Unable to connect to master or target server

This is a known issue. This happens due to the new compatibility level 140 for newly created SQL Azure databases. The issue has been documented here and updating SSDT from here to the latest version may solve the issue.

Alternatively, you can change the compatibility level of your database to 130.

ALTER DATABASE database_name   
SET COMPATIBILITY_LEVEL = 130;

Hope this helps.

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

From the deploy log, I notice that you are using the Deployment Group to run the Sql database deploy task.

The Sql database deploy task calls sqlpackage.exe on your local machine.

In the log, I also notice that the task is using the sqlpackage.exe from the Microsoft Visual Studio 14.0 folder. It seems that this folder is for visual studio 2015 instead of visual studio 2019.

On local machine the sqlpackage.exe exists in the path:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150

Here are the sample script, you could refer to it:

cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150

SqlPackage.exe /SourceFile:"C:\xxx\FIle\filename.dacpac" /Action:Publish /TargetServerName:"KEVINL\SQLEXPRESS" /TargetDatabaseName:"Testkevin6" /TargetUser:"MyNewAdminUser" /TargetPassword:"xxx"

Sample Image

You could try to use the sqlpackage.exe from visual studio 2019. If it could work, you could try to change the agent environemnt value.

DACPAC won't deploy because 'can't connect to server'?

Updating to the latest version of SSMS should fix this. It's available here: https://msdn.microsoft.com/en-us/library/mt238290.aspx

Otherwise, please confirm that the version of LocalDB you're using is LocalDB 2012. To do this you can run this query against the server:

select @@version
  • 11.0.xxxx = SQL Server 2012
  • 12.0.xxxx = SQL Server 2014
  • 13.0.xxxx = SQL Server 2016

The library that handles dacpac deployment is called the data-tier application framework, or DacFX. The version of DacFX used by SSMS 2012 is installed in:

C:\program files (x86)\Microsoft Sql Server\110\DAC\bin

Note the "110" in the path, indicating that the version of DacFX supports up to SQL Server 2012. SSMS 2014 looks for DacFX in a similar path, but in the 120 folder, and that version of DacFX supports up to SQL Server 2014, and so on.

When DacFX is asked to deploy to a server version that's newer than what is supports, it will give the "Cannot connect" error message. (The error message has been improved in newer versions of DacFX, by the way).

At one point in time, Visual Studio used the version of DacFX installed in the above path, but around the time that SQL Server 2014 support was released in the SQL Server tools, a change was made and Visual Studio got its own copy of DacFX under

C:\program files (x86)\Microsoft Visual Studio XX.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120

So this is how you can get different behavior between different versions of Visual Studio and SSMS.

Application deployment failed when connecting with the database

Did you setup the sql azure firewall to accept connections from your computer?
Even if you set it up once, it is possible that your internet provider attributed a different IP address to your computer. So you must redo your firewall set up again for your computer to be accepted.

Sample Image

It is important to know that only sql logins/passwords are accepted here. So you must give the login/password of the admin user that you mentioned at the moment of creation of you sql server azure (there is a step that sets it up when you create your azure database), or the login/password of a user you created and granted in this database.

Unable to publish DACPAC to Azure SQL Database using sqlpackage.exe

It seems you may need to update Microsoft SQL Server Data-Tier Application Framework on your computer. Please download the latest version here. After installation, you will find it on the following path C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin\SqlPackage.exe” and updates independently of SSDT / SSMS.

SSMS has its own version of SqlPackage. SSDT has its own version also, which you may find at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130.

SQL Server deploy database to Azure throws You must have a user with the same password...

I installed latest SSMS v18.3 and performed the deploy operation again and it went through without a hitch, without even requiring me to change the compatibility level



Related Topics



Leave a reply



Submit