How to view the roles and permissions granted to any database user in Azure SQL server instance?

前端 未结 4 382
遥遥无期
遥遥无期 2021-01-30 17:18

Could you guide me on how to view the current roles/permissions granted to any database user in Azure SQL Database or in general for a MSSQL Server instance?

I have thi

4条回答
  •  佛祖请我去吃肉
    2021-01-30 18:01

    if you want to find about object name e.g. table name and stored procedure on which particular user has permission, use the following query:

    SELECT pr.principal_id, pr.name, pr.type_desc, 
        pr.authentication_type_desc, pe.state_desc, pe.permission_name, OBJECT_NAME(major_id) objectName
    FROM sys.database_principals AS pr
    JOIN sys.database_permissions AS pe ON pe.grantee_principal_id = pr.principal_id
    --INNER JOIN sys.schemas AS s ON s.principal_id =  sys.database_role_members.role_principal_id 
         where pr.name in ('youruser1','youruser2') 
    

提交回复
热议问题