I moved a database from SQL Server 2012 to Azure. I don't want to use the user master
, so I created a user test
. This is what I did for database XXX on Azure:
create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test'
I checked, and the database objects I am interested in are all in the schema dbo
. The table Users
is in the schema dbo
.
The connection string in my web project has test
as the login. It produces the error message:
The SELECT permission was denied on the object 'Users', database 'XXX', schema 'dbo'
What does the error message mean and what can I do to let user test
access the database XXX?
The REFERENCES permission on a table is needed to create a FOREIGN KEY constraint that references that table. The REFERENCES permission is needed on an object to create a FUNCTION or VIEW with the WITH SCHEMABINDING clause that references that object.
Properties
.Membership
.Make sure you uncheck
db_denydatareader
db_denydatawriter
This should go without saying, but only grant the permissions to what the user needs. An easy lazy fix is to check db_owner
like I have, but this is not the best security practice.
I think the problem is with the user having deny privileges. This error comes when the user which you have created does not have the sufficient privileges to access your tables in the database. Do grant the privilege to the user in order to get what you want.
GRANT the user specific permissions such as SELECT, INSERT, UPDATE and DELETE on tables in that database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With