This is a quick post on how we can create a Read-Only User for an Azure SQL Database.
1. First, connect to the target Azure SQL Server as the admin user.
2. Now run the following script on the master database.
--on master
CREATE LOGIN [readonlyuser] WITH PASSWORD = '<password>';
CREATE USER [readonlyuser] FROM LOGIN [readonlyuser]
WITH DEFAULT_SCHEMA = [dbo];
on master |
--on target database
CREATE USER [readonlyuser] FROM LOGIN [readonlyuser]
EXEC sp_addrolemember 'db_datareader', 'readonlyuser';
on target database |
Hope this helps.
Happy Coding.
Regards,
Jaliya
No comments:
Post a Comment