Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I created an SQL server and database. I can log in to the database manage page with my administrator account, and manage the database I created, but when I try to look at the master database, it says:

Failed to create context. Details: The current user does not have VIEW DATABASE STATE permissions on this database.

What am I doing wrong? I couldn't find anything else like this on the internet.

I log in with the account that the sql server page on the azure managing portal says is the "Administrator Login".

share|improve this question

migrated from stackoverflow.com Mar 30 '13 at 11:38

This question came from our site for professional and enthusiast programmers.

    
How are you trying to "look" at the master database? –  SQLRockstar Aug 28 '13 at 0:18
add comment

1 Answer 1

What you really need is to create a new "User" first in Master DB and then use that login IS to log into your Master database.

Managing Databases and Logins in Windows Azure SQL Database

The following code example shows how to create a login, login1, and a corresponding database user named login1User that is able to create databases or other logins while connected to the master database:

 -- first, connect to the master database
 CREATE LOGIN login1 WITH password='<ProvidePassword>';
 CREATE USER login1User FROM LOGIN login1;
 EXEC sp_addrolemember 'dbmanager', 'login1User';
 EXEC sp_addrolemember 'loginmanager', 'login1User';
share|improve this answer
1  
When I tried that, the login and everything was created successfully, and I could log in with that login, but when I tried to open the master database, it said: Failed to create context. Details: The current user does not have VIEW DATABASE STATE permissions on this database. –  BaranCODE Mar 29 '13 at 19:30
    
And when I try to login into the master database in the login screen, it says: Cannot open database "manage" requested by the login. The login failed. –  BaranCODE Mar 29 '13 at 19:36
    
Does this help: social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/… –  AvkashChauhan Mar 29 '13 at 20:06
    
This is really weird. This time, I tried to login to master database with "login@servername" and it logged in (which it didn't before), but it still says Failed to create context. Details: The current user does not have VIEW DATABASE STATE permissions on this database –  BaranCODE Mar 29 '13 at 20:12
    
Wait, I might have gotten something wrong: When I was reading a guide on MSDN, it said that if I did not specify a database while loging in, it would log me in to the the master. And it also said that I would need to be in master to create databases and users. All of these work. The reason I assumed it doesn't work is because when I try to view the master database administration page, it gives the error. I am confused... –  BaranCODE Mar 29 '13 at 20:17
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.