I am trying to create a user that only has access to a few views and procedures. The user seems to be created fine, but when I attempt to log in to the user account using the connection string below, I get the error Login failed for user 'Interface_Admin'.
User ID=Interface_Admin;Password=letmein01;Integrated Security=False;server=SQL02;database=TESTDB;Trusted_Connection=False;
My code to create the user and grant permissions is below.
USE TESTDB
GO
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'Interface_Admin') DROP USER Interface_Admin
IF EXISTS (SELECT * FROM master.dbo.syslogins WHERE name = 'Interface_Admin_Login') DROP LOGIN Interface_Admin_Login
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'Interface_Users') DROP ROLE Interface_Users
-- Create role and add user accounts
CREATE ROLE Interface_Users
CREATE LOGIN Interface_Admin_Login WITH PASSWORD = 'letmein01'
CREATE USER Interface_Admin FROM LOGIN Interface_Admin_Login
EXEC sp_addrolemember @rolename='Interface_Users', @membername='Interface_Admin'
GO
-- Grant permissions
-- Views
GRANT SELECT ON Vw_Interface_Main TO Interface_Users;
-- Procedures
GRANT EXECUTE ON Proc_GetNextFileSequence TO Interface_Users;
GRANT EXECUTE ON Proc_OutboundFiles TO Interface_Users;
GRANT EXECUTE ON Proc_InsertOrUpdateFile TO Interface_Users;