You can create a login domain user in SQL Server by using SQL Server Management Studio (SSMS). Here's how:
- Connect to your SQL Server instance.
- Expand Security -> Logins.
- Right-click and select "New Login".
- In the "Login - New" dialog box, enter the domain user's name in the format "domain\username".
- Select the "Windows Authentication" option.
- Click "OK" to create the login.
You can also use Transact-SQL (T-SQL) to create a login domain user:
CREATE LOGIN [domain\username] FROM WINDOWS;
Practical Insights:
- Server Roles: You can assign server roles to the login, such as sysadmin, to grant specific privileges to the user.
- Database Roles: You can also assign database roles, such as db_owner, within specific databases to control the user's access to database objects.
- User Mappings: You need to map the login to a database user for the user to access database objects.
Example:
To create a login for the domain user john.doe from the example.com domain and grant them sysadmin privileges, you would follow these steps:
- Connect to your SQL Server instance.
- Expand Security -> Logins.
- Right-click and select "New Login".
- In the "Login - New" dialog box, enter "example.com\john.doe" in the "Login name" field.
- Select the "Windows Authentication" option.
- Select the sysadmin role under "Server Roles".
- Click "OK" to create the login.