Find out members of a database role in SQL Server

Just a quick post with a query to identify members of a specific database role in MSSQL.

FROM sys.database_role_members dbrm
INNER JOIN sys.database_principals dp
	ON dp.principal_id = dbrm.role_principal_id
INNER JOIN sys.database_principals dp2
	ON dp2.principal_id = dbrm.member_principal_id
WHERE = 'Database Role';

You may want to use this in conjunction with a previous post on identifying AD group members with Powershell.

Leave a Reply