Trying to add a new SQL Server Authentication user to an Azure SQL Database instance. The script below is being used. I am logged in as the server admin.
But the script fails at the member role assignment. The login and user are created but I cannot login to the database server.
Script:
use [master]
CREATE LOGIN test WITH password='somethingsecure';
GO
CREATE USER test FROM LOGIN test;
GO
EXEC sp_addrolemember 'db_datareader', 'test';
EXEC sp_addrolemember 'db_datawriter', 'test';
However the above script fails with the following error:
Msg 15151, Level 16, State 1, Line 6 Cannot alter the role 'db_datareader', because it does not exist or you do not have permission.
Msg 15151, Level 16, State 1, Line 6 Cannot alter the role 'db_datawriter', because it does not exist or you do not have permission.
useis not supported in Azure SQL. Is this managed instance? - Nick.McDermaidCREATE LOGINat all. - Nick.McDermaidCREATE USERwith password rather than using a login? I'd be happy to mark that as answer. - nealsu