[英]In SQL Azure how can I create a read only user
我想创建一个SQL Azure用户并授予她对少数几个DB的只读访问权限,我可以使用哪个脚本来实现这一目标?
A pure TSQL script is super messy, SQL Azure disables the USE
command, so you are stuck opening connections to each DB you need to give the user read access. 纯粹的TSQL脚本非常混乱,SQL Azure会禁用USE
命令,因此您需要打开与每个数据库的连接,以便为用户提供读取访问权限。
This is the gist of the pattern. 这是模式的要点。
In Master DB: 在Master DB中:
CREATE LOGIN reader WITH password='YourPWD';
-- grant public master access
CREATE USER readerUser FROM LOGIN reader;
In each target DB (requires a separate connection) 在每个目标DB中(需要单独的连接)
CREATE USER readerUser FROM LOGIN reader;
EXEC sp_addrolemember 'db_datareader', 'readerUser';
OR... Use the Azure User Management console - AUMC to manage the Logins and Users. 或者...使用Azure用户管理控制台 - AUMC来管理登录和用户。
It's a open source project available on codeplex AUMC.codeplex.com 它是codeplex AUMC.codeplex.com上的一个开源项目
Project Description 项目描述
Azure User Management Console - AUMC is a User Graphic Interface (GUI) that manages the users and logins of an Azure SQL database. Azure用户管理控制台 - AUMC是一个用户图形界面(GUI),用于管理Azure SQL数据库的用户和登录。 The tool is simply converting your action into T-SQL commands and execute them on the Azure SQL Database. 该工具只是将您的操作转换为T-SQL命令,并在Azure SQL数据库上执行它们。
A quick simple tool with a user interface! 一个带用户界面的快速简单工具! Don 唐
Enjoy! 请享用!
You can create new user without creating login on master DB (which is require make a separate connection) 您可以创建新用户而无需在主 DB上创建登录(这需要进行单独的连接)
CREATE USER user1 WITH password='<Strong_Password>';
https://azure.microsoft.com/en-us/documentation/articles/sql-database-manage-logins/ https://azure.microsoft.com/en-us/documentation/articles/sql-database-manage-logins/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.