Explore Courses Blog Tutorials Interview Questions
0 votes
in Azure by (17.6k points)
edited by

I am creating a new read/write user on SQL Azure as follows:

-- Connected to master
create login [fred] with password = 'xxx';

-- Connected to my DB
create user [fred] from login fred;
EXEC sp_addrolemember 'db_datareader', 'fred';
EXEC sp_addrolemember 'db_datawriter', 'fred';

When I log in using SSMS I get an error saying Cannot open database "master" requested by the login. The login failed.

What am I doing wrong or missing?

1 Answer

0 votes
by (47.2k points)
  • SSMS tries to connect to the master database by default, but your new account does not have access to the master database

  • In the SSMS portal, you need to specify the database on the options, which opens up the Connection Properties tab. Now specify the database name over there which you are trying to connect to.

Browse Categories