简体   繁体   English

在SQL Azure中,如何创建只读用户

[英]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.

相关问题 无法以只读用户身份登录SQL Azure数据库 - Cannot login with read-only user to SQL Azure database 如何在PostgreSQL中创建只读用户? - How to create a read-only user in PostgreSQL? 如果SQL Server数据库是只读的,我可以授予单个用户写访问权限吗? - If a SQL Server Database is read only can I grant a single user write access? 我可以人为地限制用户的sql权限只能读取我的应用程序的任何连接吗? - Can I artificially restrict a user's sql permissions to be read only for any connections from my application? SQL Azure 管理员用户可以创建其他管理员吗? - Can a SQL Azure admin user create other admins? 如何在 Azure SQL Server 中创建具有系统管理员权限的新用户? - How to create a new user with sysadmin privilege in Azure SQL Server? 如何在SQL Azure中创建数据库的登录名,用户和授予权限? - How to create a login, user, and give rights over database in SQL Azure? 我可以在数据库中创建一个与 SQL USER 同名的用户吗? - Can i create a user in a database with the same name as SQL USER? 如何从Sql数据库中仅读取10行? - How can I read only 10 rows from my Sql Database? 如何在添加到项目的SQL Server Express数据库中创建用户? - How can I create a user in SQL Server Express database I added to my project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM