Feb132013

Creating New SQL Azure Logins and Users

Until recently, I didn't realize that SQL Azure allows you to create new logins, users, and roles. They don't expose this functionality through the UI, it all has to be done through T-SQL commands.

For example:

  1. Run this when connected to master: `sql CREATE LOGIN MyReportingUser WITH PASSWORD='MyP@assWord123'
3. Then connect to the database you want to add the user to and run this: ```sql
CREATE USER MyReportingUser FROM LOGIN MyReportingUser
  1. You can then grant them a role: `sql EXEC sp_addrolemember 'db_datareader', 'MyReportingUser'
You can then connect to your SQL Azure database using that new login.

Via: [Azure How-To Talk Series: How To: Manage SQL Azure Security](http://azure-howto.blogspot.com/2011/06/how-to-manage-sql-azure-security-logins.html "Azure How-To Talk Series: How To: Manage SQL Azure Security - Logins, Users, Roles, Schemas and Permissions").