Failed to connect to server


Having an issue with SQLAzureMWBatchBackup. When attempting to run the SQLAzureBatchBackup on an Azure Database for backup (download) I received the error:
 Failed to connect to server MYDBNAME_.database.windows.net. 
However using the same credentials I am able to run successfully SQLAzureMW & bcp.exe on the Azure database.

I have quadruple checked servername, user, password, & database. I have tried command line arguments, -S, -U, -P etc... and modifying the config. The error references the correct Azure server name.

Any ideas?


ghuey wrote Feb 5, 2016 at 12:49 AM


What version of SQLAzureMW are you using and what version of SQL Server are you running on? I just did a test and it worked:

SQLAzureMWBatchBackup -S pjewuzpfds.database.windows.net -D Northwind -U bygeorge -P "My$ecr3t@$sw0rd$!!"

I have a couple more machines at work, I will try them.

Sorry for the issue,

cpownall wrote Feb 5, 2016 at 3:23 AM

SQL is latest version V12

SQLAzureMWBatchBackup & SQLAzureMW are version

SQLAzureMW is fine, still cannot connect using BatchBackup

However I cannot connect with either using your server:

-S pjewuzpfds.database.windows.net -D Northwind -U bygeorge@pjewuzpfds -P "My$ecr3t@$sw0rd$!!"

wrote Feb 17, 2016 at 12:34 PM

Selecters75 wrote Feb 17, 2016 at 12:40 PM

Hello, I'm able to reproduce this same exact issue in the same conditions.
Same SQLAzureMWBatchBackup & SQLAzureMW versions, same Azure SQL versions. SQLAzureMW is fine, I'm able to connect manually. However SQLAzureMWBatchBackup failed to connect to server.
Any idea?

ghuey wrote Mar 5, 2016 at 4:08 PM


I have to say sorry, I don't. I have tried several different machines and SQLAzureMWBatchBackup just works.

Both SQLAzureMW and SQLAzureMWBatchBackup use the same core code. Do you see any kind of errors in the Results.txt file (where your data is backup too)?


cpownall wrote Apr 18, 2016 at 8:19 PM

No errors in results.txt.

The only entry in Results.txt is:

SQLAzureMWBatchBackup, Version

Checked firewall, no restrictions but see it go out on port 1433.

Backup directory is default: C:\SQLAzureMW\BCPData. It works as I see date time directory.

I am wondering if it has som,ehting to do with the password have a '- ' (Dash) character causing the program to screw up. Seen it in perl with ! @ & in passwords before. However the SQLAzureMW interface does not have an issue with it.

ghuey wrote Apr 19, 2016 at 1:17 AM

Hi, it was a good thought. I created a new server and setup an admin with a password that contained a '-' (Dash) and everything worked like expected. I was able to upload and download with no problem. If you want, contact me offline via codeplex and we can talk about creating a temporary server that both of us can use to do some testing.


cpownall wrote Apr 20, 2016 at 2:10 AM

Would you mind testing with the '-' (dash) at the end of the password and let me know. If it still persists we'll go offline. I am even able to connect via sqlcmd so I think it may be a setting but command line is not working either for:

SQLAzureMWBatchBackup.exe -S MyAzureServer.database.windows.net -U User_Name@MyAzureServer -P "The_Password_with_a_Dash" -D MyDatabase.

Unfortunately this is a SaS db for our quoting software that I cannot control very easily. However they require us to perform the backups. For now we have been manually backing up via SQLAzureMW and cancelling when the Target upload comes up.

Thanks for the input and the work so far. Good stuff.

wrote Dec 8, 2016 at 3:17 PM

clns wrote Dec 8, 2016 at 3:19 PM

I have exactly the same issue, can connect from PHP, SQLAzureMW and BCP, but not using SQLAzureMWBatchBackup, with the exact same credentials. My password however doesn't have a dash "-" in it, only a "!", if that matters.

At this point I cannot use SQLAzureMWBatchBackup.

clns wrote Dec 8, 2016 at 3:49 PM

I think it has to do with this:

The server principal "USER" is not able to access the database "master" under the current security context.
Database 'master' on server 'XXX.worker.database.windows.net' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'xxx-xx-xxxx'.

Maybe SQLAzureMWBatchBackup always requires "master" instead of using the db specified using -D ?