SQL Schema Comparison Error "Target is unavailable"

I have found that using username@servername as the username for connecting will fix the issue when it happens against Azure databases. I've had connections that have historically worked without doing this suddenly stop and then this has fixed it for me.

For instance, when using a login of mylogin and connecting to myserver.database.windows.net, if I instead use [email protected] as the username I won't get the "Source is unavailable" issue.


I get this error in Visual Studio 2017 when I use SQL Server Authentication but don't save the password. I've tested these steps with Visual Studio 15.6.3 and SQL Server 12.0.5000.0

Fixing the error

This fixes the problem, but the problem comes back the next time I restart Visual Studio.

  1. Go to Tools -> SQL Server -> New Schema Comparison...
  2. Select either Select Source or Select Target
  3. Select Select Connection
  4. Under Recent Connections, find all connections that gave you this error
  5. For each of these, right-click the connection and select Remove from History
  6. Restart Visual Studio

Preventing the error from coming back

  1. Complete Fixing the error above
  2. When you are setting the connection details, check the Remember Password checkbox.

Reproducing the error

If you want to troubleshoot this error, here is how I managed to reproduce it.

  1. Go to Tools -> SQL Server -> New Schema Comparison...
  2. Select a source and target connection
  3. For at least one connection, use SQL Server Authentication but don't select Remember Password
  4. Press Compare
  5. Ensure it works without errors
  6. Restart Visual Studio
  7. Repeat steps 1-4, using the exact same connection details