Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give sysadmin permission to user in Azure SQL Database

How to grant sysadmin permissions to user in Azure SQL Database or how to give same level of access to a user in Azure SQL Database?

like image 536
Champ Avatar asked Nov 27 '15 09:11

Champ


1 Answers

Use the azure portal. server-level principal login should be used to grant access to individual databases.

One can create new user & give rights to one or more databases:

    -- in master
create login [XXXX] with password = 'YYYYY'
create user [XXXX] from login [XXXX];

-- if you want the user to be able to create databases and logins
exec sp_addRoleMember 'dbmanager', 'XXXX';
exec sp_addRoleMember 'loginmanager', 'XXXX'

-- in each individual database, to grant dbo
create user [XXXX] from login [XXXX];
exec sp_addRoleMember 'db_owner', 'XXXX';

If you just created a login and a corresponding user, you have to add the appropriate role memberships...

e.g.,

exec sp_addrolemember 'dbmanager', 'login1User';
exec sp_addrolemember 'loginmanager', 'login1User';
like image 91
Nishant Singh Avatar answered Sep 30 '22 01:09

Nishant Singh