Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

users assigned a sql azure role

I am trying to make sure that all users have been assigned a particular role. Is there any view or SQL query for getting this information?

like image 211
user682732 Avatar asked Oct 06 '11 00:10

user682732


People also ask

How do I see user roles in Azure SQL?

Expand the Azure SQL DB and navigate to security -> Roles -> Database Roles to get a list of available fixed database roles, expand the Azure SQL DB and navigate to Security -> Roles -> Database Roles. You get the following fixed-database roles.

How do you check what roles a user has in SQL Server?

To find all the role assignments to users in SQL Server database, you can use the following query. SELECT r.name role_principal_name, m.name AS member_principal_name FROM sys. database_role_members rm JOIN sys. database_principals r ON rm.

How do you assign a user to a role in SQL?

Right-click the role you want to edit and select Properties. In the Database Role Properties -database_role_name dialog box, in the General page, click Add. In the Select Database User or Role dialog box, under Enter the object names to select (examples), enter the login or database role to add to this database role.


1 Answers

The views have changed names but the following should work against SQL Azure

select m.name as Member, r.name as Role
from sys.database_role_members
inner join sys.database_principals m on sys.database_role_members.member_principal_id = m.principal_id
inner join sys.database_principals r on sys.database_role_members.role_principal_id = r.principal_id
like image 193
gplwhite Avatar answered Oct 01 '22 01:10

gplwhite