title: Visual Studio Team Services Build Failed - Database Project to Azure SQL
body: <p>I have a build in Team Services (was Visual Studio Online), with one MSBuild step that is configured to build and deploy a DB project, using a publish profile. I can't seem to succeed in authenticating it. When I queued the Team Services build definition, I am able to build the DB Project and produce the .dacpac. However, come publish time and this error comes:</p>
  
  <p><strong>C:\a\1\s\Source\ShopDatabase\bin\Output\MyDatabase.publish.sql(0,0): Error Deploy72002: Unable to connect to master or target server 'mydb'. You must have a user with the same password in master or target server 'mydb'.</strong></p>
  
  <p>We're certain the user exists in the mydb and the master db in Azure.</p>
  
  <p>Target: Azure SQL Database</p>
  
  <p>DB project Target Platform: Microsoft Azure SQL Database</p>
  
  <p>When I run the publish profile directly from Visual Studio, it works. But in Team Services build definition, it doesn't. I tried these as MSbuild arguments:</p>
  
  <p><strong>/t:Build;Publish /p:SqlPublishProfilePath="myproject.Dev.publish.xml" /p:Password="mypassword"</strong></p>
  
  <p>and this:</p>
  
  <p><strong>/t:Build;Publish /p:SqlPublishProfilePath="myproject.Dev.publish.xml" /p:TargetConnectionString="Data Source=myproject.database.windows.net;Persist Security Info=True;User ID=myuser;Password=mypassword;" /p:VisualStudioVersion=14.0 /p:Username="myuser" /p:Password="mypassword"</strong></p>
  
  <p>and this:</p>
  
  <p><strong>/t:Build;Publish /p:SqlPublishProfilePath="myproject.Dev.publish.xml" /p:TargetConnectionString="Data Source=myproject.database.windows.net;Persist Security Info=True;User ID=myuser;Password=mypassword;" /p:VisualStudioVersion=14.0 /p:TargetUserName="myuser" /p:TargetPassword="mypassword"</strong></p>
  
  <p>But won't work. Please help me T_T been searching the net for 6 hours already</p>