SQL Azure: 'Generating Logins, Adding Users' to database

When you generate a SQL Azure server via SQL Azure portal, you generate administrative user name & password, and has access to all databases on that server. However, you might want to give other people access to some or all of your databases on that server, with full or restricted permissions. Currently, SQL Azure portal […]

When you generate a SQL Azure server via SQL Azure portal, you generate administrative user name & password, and has access to all databases on that server. However, you might want to give other people access to some or all of your databases on that server, with full or restricted permissions.

Currently, SQL Azure portal doesn't allow you to administrate additional users & logins, in order to do this you need to use Transact-SQL. The easiest way to execute Transact -SQL against SQL Azure is to use SQL Server Management Studio 2008 R2, which'll list "users & logins" associated with databases; however, at this time it doesn't provide a graphical user interface for creating users & logins.

Here're some sample Transact-SQL:

  • Generating Logins: CREATE LOGIN readonlylogin WITH password='1231!#ASDF!a';
  • Creating Users: CREATE USER readonlyuser FROM LOGIN readonlylogin;
  • User Permissions: EXEC sp_addrolemember 'db_datareader', 'readonlyuser';

More Info: Managing Databases and Logins in SQL Azure (MSDN)

[Source]