none
Cannot open database "master" requested by the login. The login failed. SQL Azure membership provider

    Question

  • I am working on Membership and role management (SQL Azure). As per my knowledge the best way to achieve this in case of SQL Azure is using UNIVERSAL PROVIDERS (http://www.hanselman.com /blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx  ).
    But I am facing database connection error while trying to create roles through WSAT(Visual Studio).
    The database to which i should connect is config.
     
    Cannot open database "master" requested by the login. The login failed. Login failed for user 'xxxxx. This session has been assigned a tracing ID of 'ba41e811-6f2b-4ba8-bb98-678777ca2f79'. Provide this tracing ID to customer support when you need assistance. (This is through connection string in webconfig)


     Need urgent help....
    Thursday, May 24, 2012 1:31 PM

Answers

  • Hi VMachu,

    Thank you for your update.  Seems it might be related to the connection string issue. Could you share your connection string with us for further troubleshooting?

    The SQL Azure connection string looks like that:
    Server=tcp:[serverName].database.windows.net;Database=[NameOfUserDb];Uid=[LoginForDb]@[serverName];Pwd=myPassword;Encrypt=yes;

    Please note SQL Azure server name to the login in the connection string using the <login>@<server> notation. For example, if your login was named login1 and the fully qualified name of your SQL Azure server is servername.database.windows.net, the username parameter of your connection string should be: login1@servername.

    For more information, please refer to
    1. Guidelines for Connecting to SQL Azure Database

    2. Managing Databases and Logins in SQL Azure

    Regards,
    Amber zhang
    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.

    Friday, May 25, 2012 6:55 AM
  • Hi,

    The user you created does not have access to master by default (unless you also grant that user access to master). So when you connect to SQL Azure without specifying initial catalog, it will attempt to connect to master. And fail.

    Using the initial catalog is your only valid option. It seems you said you were going to try that. Did it work for you?


    Herve Roggero, MVP SQL Azure Co-Author: Pro SQL Azure http://www.herveroggero.com

    Wednesday, May 30, 2012 1:57 AM

All replies

  • Hi,

    Have you created the user for that login?

    CREATE LOGIN MyUserName WITH PASSWORD = 'Password';

    CREATE USER MyUserName FOR LOGIN MyUserName;



    If you found this post useful, Please "Mark as Answer" or "Vote as Helpful". Best Regards.

    Thursday, May 24, 2012 2:54 PM
  • For the config database, user and password are created.In the connection string i am passing the username and password.Yet it fails with the above error.

    By default it should connect to config database but i don't know why it is pointing to master.Through SSMS i can set the default connection database.I am doing the same here using initial catalog.

    Any help??

    Friday, May 25, 2012 2:58 AM
  • Hi VMachu,

    Thank you for your update.  Seems it might be related to the connection string issue. Could you share your connection string with us for further troubleshooting?

    The SQL Azure connection string looks like that:
    Server=tcp:[serverName].database.windows.net;Database=[NameOfUserDb];Uid=[LoginForDb]@[serverName];Pwd=myPassword;Encrypt=yes;

    Please note SQL Azure server name to the login in the connection string using the <login>@<server> notation. For example, if your login was named login1 and the fully qualified name of your SQL Azure server is servername.database.windows.net, the username parameter of your connection string should be: login1@servername.

    For more information, please refer to
    1. Guidelines for Connecting to SQL Azure Database

    2. Managing Databases and Logins in SQL Azure

    Regards,
    Amber zhang
    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.

    Friday, May 25, 2012 6:55 AM
  • Hi,

    The user you created does not have access to master by default (unless you also grant that user access to master). So when you connect to SQL Azure without specifying initial catalog, it will attempt to connect to master. And fail.

    Using the initial catalog is your only valid option. It seems you said you were going to try that. Did it work for you?


    Herve Roggero, MVP SQL Azure Co-Author: Pro SQL Azure http://www.herveroggero.com

    Wednesday, May 30, 2012 1:57 AM