Create custom user login for Azure SQL Database

Windows Azure user management is a little bit complicated, and unfortunately, there is no way to add users to existing database using Windows Azure management portal.

To add a new user to existing database in windows azure you have to do the following:

First, you need to create a new login on MASTER database using the following command

Important

It is important to verify what database is currently selected, the next step in creating a user in the Azure database should be done on MASTER database
CREATE LOGIN MyNewDbUser 
WITH PASSWORD = 'P@ssw0rd' 
GO

Then you have to create User on your database using previously established login, using the following command

create user login for azure database

Important

Now you need to switch database to your database where you want to add a user. It is not MASTER database anymore
CREATE USER MyNewDbUser 
FOR LOGIN MyNewDbUser 
GO

And the last step is to add permissions for the database

Now switch to your database again.
EXEC sp_addrolemember N'db_owner', N'MyNewDbUser' 
GO

How to create new database login in Microsoft Azure (Video)



Comments

Social media

Search

Latest Tweets