Creating a Database User - SQL Azure

References


Procedure

1. Connect to your SQL Azure instance as an administrator to the MASTER database (That is, within SSMS Object Explorer, right-click the MASTER database and choose "New Query")

2. Execute the following script in the MASTER database

CREATE LOGIN MyUserName WITH PASSWORD=N'MyPassword'
GO
CREATE USER MyUserName FOR LOGIN MyUserName
GO
ALTER USER MyUserName WITH DEFAULT_SCHEMA=[dbo]
GO

3. Open a NEW QUERY against the application database

4. Execute the following script in the application database

CREATE USER MyUserName from LOGIN MyUserName
go
ALTER ROLE [db_datareader] ADD MEMBER MyUserName
GO
ALTER ROLE [db_datawriter] ADD MEMBER MyUserName
GO
--This next line is optional
--GRANT EXECUTE ON schema::dbo TO MyUserName
GO