如何查看在 Azure SQL 服务器实例中授予任何数据库用户的角色和权限?

编程入门 行业动态 更新时间:2024-10-23 14:28:00
本文介绍了如何查看在 Azure SQL 服务器实例中授予任何数据库用户的角色和权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您能否指导我如何查看授予 Azure SQL 数据库中的任何数据库用户或一般的 MSSQL Server 实例的当前角色/权限?

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?

我有以下查询:

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.role_principal_id = r.principal_id JOIN sys.database_principals m ON rm.member_principal_id = m.principal_id WHERE r.name IN ('loginmanager', 'dbmanager');

我还需要知道授予这些角色loginmanager"和dbmanager"的权限是什么?

I further need to know what are the permissions granted to these roles "loginmanager" and "dbmanager"?

你能帮我解决这个问题吗?

Could you help me on this?

推荐答案

根据 sys.database_permissions,此查询列出了您所连接的数据库中的主体明确授予或拒绝的所有权限:

Per the MSDN documentation for sys.database_permissions, this query lists all permissions explicitly granted or denied to principals in the database you're connected to:

SELECT DISTINCT pr.principal_id, pr.name, pr.type_desc, pr.authentication_type_desc, pe.state_desc, pe.permission_name FROM sys.database_principals AS pr JOIN sys.database_permissions AS pe ON pe.grantee_principal_id = pr.principal_id;

根据 管理 Azure SQL 数据库中的数据库和登录, loginmanager 和 dbmanager 角色是 Azure SQL 数据库中可用的两个服务器级安全角色.loginmanager 角色有创建登录的权限,dbmanager 角色有创建数据库的权限.您可以使用上面针对 ma​​ster 数据库的查询来查看哪些用户属于这些角色.您还可以在连接到每个用户数据库时使用相同的查询(减去过滤谓词)来确定用户在每个用户数据库上的角色成员资格.

Per Managing Databases and Logins in Azure SQL Database, the loginmanager and dbmanager roles are the two server-level security roles available in Azure SQL Database. The loginmanager role has permission to create logins, and the dbmanager role has permission to create databases. You can view which users belong to these roles by using the query you have above against the master database. You can also determine the role memberships of users on each of your user databases by using the same query (minus the filter predicate) while connected to them.

更多推荐

如何查看在 Azure SQL 服务器实例中授予任何数据库用户的角色和权限?

本文发布于:2023-10-29 03:35:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538609.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:看在   实例   角色   权限   服务器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!