Connect to a SQL Azure Database Using SSMS or SQLCMD

As at launch in January 2010 SSMS can connect to SQL Azure, but the object browser does not work.

  1. Ensure that you have setup the SQL Azure firewall to allow your IP to connect to SQL Azure.
  2. Start up SSMS and when the connection dialog appears hit Cancel, this is due to a connection error bug if the initial connection dialog is used (this issue is unfixed as at Azure’s Jan 2010 launch but a patch is promised).
  3. From SSMS click New Query which should launch the connection dialog again. You will need to enter your SQL Azure database login credentials. The Server Name and Admin name are as in the SQL Azure Portal and your password is initially set your SQL Azure online portal’s password (these details can also be taken from the connection string for a database).


    Enter the details into the connection dialog and select SQL Server Authentication as the authentication method (SQL Azure doesnt support Windows Authentication).

    You are now connected to SQL Azure, but as noted above, the object browser won’t display your database objects so the primary use of SSMS for SQL is to execute TSQL.

    NOTE – If you are using SSMS pre 2008 R2, the SQL Azure objects will not be visible. If possible, you should use the SSMS that ships with SQL Server 2008 RS to connect to SQL Azure.

Connecting to Azure using SQLCMD

SQLCMD connections are supported in SQL Azure using the below syntax:


Connecting to SQL Azure via SQLCMD
C:>sqlcmd -S  -U  -P  -S  -d 

All these credentials are as above except for USER which is in the format username@server , where username is the user’s login name and server is the first section of the server name before database.windows.net.



Array
Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!