SQL Server Availability Groups – How to Manage Logins

availability-groupssql serversql server 2014sql-server-2012

I am new to Always On Availability Groups and I am little bit confused with creation of logins.

Let's assume an environment NODE1(Primary) & NODE2(secondary) & NODE3(Stand by) & VAEWI(Listener).

  1. I need to create a SQL authentication login.

    For this, I assume I need to create it by connecting to listener that which will sync in all of the nodes.

  2. I need to create a Windows authentication.

    For this I think, as all of the nodes are window-clustered before creating the availability group. So, we need to create a Windows user 1st in primary node and then create a Windows authentication by connecting to the listener.

Can anyone let me know if my assumptions are true?

Best Answer

Putting in a simple language :

A login gives you access to server.

A user gives you access to database.

A login must map a user so that you can access the database.

For SQL Authentication, you should create the login with SAME SID and map it to your user database/s on all the nodes with proper permissions (follow the principle of least privileged). This script will help you or this SSMS addin from sqlskills.

For Windows Authentication, you should create a login and map it to your user database. Create/transfer the same login to other nodes.

A listener is a virtual interface and has nothing to do with logins or users.