Partager via


Administrator login in Azure SQL DB

Consider the database name is ‘test’.

Connect to ‘master’:

CREATE LOGIN login1 WITH password='<ProvidePassword>';
CREATE USER login1User FROM LOGIN login1;
EXEC sp_addrolemember 'dbmanager', 'login1User'; --- if the database level permission are needed for the login ‘login1user’
EXEC sp_addrolemember 'loginmanager', 'login1User'; --- if this login should be able to create and manage other logins

Now connect to the user database ‘test’

CREATE USER login1User FROM LOGIN login1;
EXEC sp_addrolemember 'db_owner', ‘login1User’; --- after executing this command,you will be able to view and manage tables

Now you will be able to manage with admin privileges with the login ‘login1’.