How to create Sql Server login for a domain account?
Don't create a local account with the same name as the domain account. If you want to add a domain login as a sql admins do as follows:
- create a login for the domain account:
create login [AD\Sql1] from windows;
- add the login to sysadmin group:
exec sp_addsrvrolemember 'AD\Sql1', 'sysadmin';
Done. You would achieve the same result if you'd simply add the AD\Sql
account to the local administrators via net localgroup Administrators /add AD\Sql1
(from a CMD shell) but that is not the correct solution as it grants AD\Sql1
all NT administrator privileges in addition to granting him SQL admin, which is not stated as a requirement therefore is unnecessary elevation. BTW the rule that members of the local Administrators group are SQL admins is not implicit, is an explicit privilege granted by default during SQL Setup and it can be revoked so you have to check for it.
Connect to your instance in SSMS. Expand security / logins. Rt-click add new login, put in the info. On server roles, grant it sysadmin if you want it to have total power over the SQL instance. Done. This account does not need to be local admin on your Windows machine to be sysadmin in SQL Server.