Just recently, I was testing out some stuff with SQL Azure. Then I got this bright idea of giving out the connection string to some friends, also for testing. As it turned out.. they all tried and succeeded in inserting data, a lot of data. So I got to thinking, is it possible to give out sql azure as read only?
Well there’s no better way than to try.
So I logged in to my SQL Azure DB and clicked “Manage” on the Master DB. This should restrict writing to ALL my databases as SQL Azure still does not support the USE keyword.
Then I create a readonly login
Then I create a user as guestreadonly
OK. So I have a type and a user. What I need to do next is to assign the role to the user and that’s it!
EXEC sp_addrolemember ‘db_datareader’, ‘guestuser’;