问题
I've followed the answer to this question: In SQL Azure how what script can I use to create a read only user
I've completed all the steps successfully on the correct server. However, when I try to login to the Azure database, I'm getting the following error:
Login failed for user 'readerUser'.
This session has been assigned a tracing ID of '(some guid)'.
Provide this tracing ID to customer support when you need assistance.
I've tried this in both my ASP.NET website and in my LINQPad, they both give the same error (with different GUIDs). I am trying to connect to the exact same server as my primary login, which can connect perfectly.
I've also checked sys.sysusers
system view and readerUser
is there as a login.
What could be the reason?
回答1:
After trying many combinations (and learning better about users, logins, and roles on SQL Azure) I've figured out the issue:
I was trying to login with readerUser
, which is just a database user, and I should instead have logged in with the login instance, hence reader
(as followed by the answer at the question that I've linked). I've tried logging in with reader
and it worked perfectly: logging in, SELECT
ing anything I want, but not able to write/alter/delete anything.
来源:https://stackoverflow.com/questions/23964984/cannot-login-with-read-only-user-to-sql-azure-database