New user cannot login to SQL Azure

后端 未结 6 2646
臣服心动
臣服心动 2020-12-13 08:19

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
creat         


        
6条回答
  •  执念已碎
    2020-12-13 08:43

    For me, the issue was that the person who created the user on the database did so without specifying FROM LOGIN, therefore the user was available in the Security->Users tab, but login was still not possible. I had to recreate the user and linking it to the login with the same name on the database:

    DROP USER [myuser]
    GO
    
    CREATE USER [myuser] FROM LOGIN [myuser] WITH DEFAULT_SCHEMA=[dbo]
    GO
    

    and then granting the correct permissions on the database, in my case:

    ALTER ROLE db_datareader ADD MEMBER [myuser]
    ALTER ROLE db_datawriter ADD MEMBER [myuser]
    

提交回复
热议问题