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

随声附和 提交于 2019-12-05 05:19:06

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.

Komal Bisen
Initializing deployment (Start)
Initializing deployment (Failed)
*** Could not deploy package.
Unable to connect to master or target server 'DbName'. You must have a user with the same password in master or target server 'DbName'.

Issue occurred while deploying build through VisualStudio-2015 and it support to publish database on the database servers whose version up to only 2016.

Solution: For SQL server 2017 we need to Publish Database with Visual Studia 2017 only. Need to upgrade SSDT.

Faced same issue when trying to deploy a DB from local SQL Server to Azure SQL DB via SSMS.

Tried to alter source DB's compatibility level to 130, still got same error.

Tried to add same user logins to master DB, no help.

Eventually, started looking for other approaches. Succeeded by using Data Migration Assistant, as instructed in https://docs.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate.

My situation was slightly different in that I had exported an Azure database (with compat level 140) from SQL Azure and then tried to import it into a local SQL Server 2017 installation - using the latest SSMS 2017 that I just installed yesterday - and still got this message.

Turned out that although I did have latest SSMS installed, I was actually opening SSMS 2016 by mistake! So be sure to select and pin the correct version to avoid it happening again. Just typing 'SSMS' into the Windows Start menu may not show both.

So if you use SSMS to import you only need the latest version, and no separate tools.


Footnote: Even after opening the correct SSMS version I got another error - something about contained databases.

An Azure database is a 'contained' database (or at least mine was) - meaning that its user logins are embedded in the database. This isn't enabled by default apparently in standard SQL Server 2017.

After running this in the local SQL in master I was able to import it successfully.

sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO

* to publish to a SQL Server database in Azure*, you can use "Data Migration Assistant" (DMA).

I just tried it and it works smoothly without any issues (firewall and compatibility level)

please refer to this link SQL Server database migration to Azure SQL Database

for step by step: 10. How to migrate the SQL database to Azure with the Azure Database Migration Service

I got the same error while trying to update a local SQL Server database from Visual Studio database project (i.e. not i Azure). Turns out the problem was I was running SSDT for Visual Studio 2017 while using Visual Studio 2015. Visual Studio discovered an updated version of SSDT (just happened to see it in notifications!), pointing to the right Visual Studio version. Now it works!

My setup: BizTalk Server 2016 forces me to use Visual Studio 2015. My local database is on SQL Server 2017. Using SSDT for Visual Studio 2015 works for updating databases in SQL Server 2017. Just so you know. ;)

When this happened to me it was due to the version of tools I was using. I thought it strange that the most recent SqlPackage.exe I found in C:\Program Files (x86)\Microsoft SQL Server didn't work and publishing from visual studio did, so I found the most recent under the visual studio directories:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\SqlPackage.exe

Try to connect to the SQL Azure database using Sql Server Management Studio and the ip getting listed in the management studio is the right ip address. Try to add to the SQL Azure firewall rules. The ip address listed in the firewall page of Sql Azure portal is not accurate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!