I’ve created a new SQL user along with a new role in our warehouse db project using Visual Studio 2012.
CREATE LOGIN [newuser] WITHPASSWORD=’{{ RANDOM PASSWORD }}’,DEFAULT_DATABASE=[Database]
GO
CREATE USER [newuser] FORLOGIN [newuser] WITHDEFAULT_SCHEMA=[dbo]
GO
ALTER ROLE [newrole] ADD MEMBER [newuser]
GO
Problem is, the user is disabled. When you do it manually via SQL Management Studio, it’s enabled and working. Manually enabling the account doesn’t allow it connect either. A quick Google revealed:
http://www.sqlhammer.com/blog/creating-logins-and-users-why-i-cant-connect/
Bingo. Appears I need to add the following to the end of the script:
GRANT CONNECT TO [newuser]