Join a SUSE Linux Enterprise virtual machine to a Microsoft Entra Domain Services managed domain
مقالة
To let users sign in to virtual machines (VMs) in Azure using a single set of credentials, you can join VMs to a Microsoft Entra Domain Services managed domain. When you join a VM to a Domain Services managed domain, user accounts and credentials from the domain can be used to sign in and manage servers. Group memberships from the managed domain are also applied to let you control access to files or services on the VM.
This article shows you how to join a SUSE Linux Enterprise (SLE) VM to a managed domain.
Prerequisites
To complete this tutorial, you need the following resources and privileges:
When you create the VM, pay attention to the virtual network settings to make sure that the VM can communicate with the managed domain:
Deploy the VM into the same, or a peered, virtual network in which you have enabled Microsoft Entra Domain Services.
Deploy the VM into a different subnet than your Microsoft Entra Domain Services managed domain.
Once the VM is deployed, follow the steps to connect to the VM using SSH.
Configure the hosts file
To make sure that the VM host name is correctly configured for the managed domain, edit the /etc/hosts file and set the hostname:
Bash
sudo vi /etc/hosts
In the hosts file, update the localhost address. In the following example:
aaddscontoso.com is the DNS domain name of your managed domain.
linux-q2gr is the hostname of your SLE VM that you're joining to the managed domain.
Update these names with your own values:
config
127.0.0.1 linux-q2gr linux-q2gr.aaddscontoso.com
When done, save and exit the hosts file using the :wq command of the editor.
Join VM to the managed domain using SSSD
To join the managed domain using SSSD and the User Logon Management module of YaST, complete the following steps:
Install the User Logon Management YaST module:
Bash
sudo zypper install yast2-auth-client
Open YaST.
To successfully use DNS autodiscovery later, configure the managed domain IP addresses (the Active Directory server) as the name server for your client.
In YaST, select System > Network Settings.
Select the Hostname/DNS tab, then enter one or more IP addresses of the managed domain into the text box Name Server 1. These IP addresses are shown on the Properties window in the Microsoft Entra admin center for your managed domain, such as 10.0.2.4 and 10.0.2.5.
Add your own managed domain IP addresses, then select OK.
From the YaST main window, choose Network Services > User Logon Management.
The module opens with an overview showing different network properties of your computer and the authentication method currently in use, as shown in the following example screenshot:
To start editing, select Change Settings.
To join the VM to the managed domain, complete the following steps:
In the dialog box, select Add Domain.
Specify the correct Domain name, such as aaddscontoso.com, then specify the services to use for identity data and authentication. Select Microsoft Active Directory for both.
Make sure the option for Enable the domain is selected.
When ready, select OK.
Accept the default settings in the following dialog, then select OK.
The VM installs additional software as needed, then checks to see if the managed domain is available.
If everything is correct, the following example dialog is shown to indicate the VM discovered the managed domain but that you're Not yet enrolled.
To make sure that the current domain is enabled for Samba, activate Overwrite Samba configuration to work with this AD.
To enroll, select OK.
A message is shown to confirm that you're successfully enrolled. To finish, select OK.
After the VM is enrolled in the managed domain, configure the client using Manage Domain User Logon, as shown in the following example screenshot:
To allow sign-ins using data provided by the managed domain, check the box for Allow Domain User Logon.
Optionally, under Enable domain data source, check additional data sources as needed for your environment. These options include which users are allowed to use sudo or which network drives are available.
To allow users in the managed domain to have home directories on the VM, check the box for Create Home Directories.
From the side bar, select Service Options › Name switch, then Extended Options. From that window, select either fallback_homedir or override_homedir, then select Add.
Specify a value for the home directory location. To have home directories, follow the format of /home/USER_NAME, use /home/%u. For more information about possible variables, see the sssd.conf man page (man 5 sssd.conf), section override_homedir.
Select OK.
To save the changes, select OK. Then make sure that the values displayed now are correct. To leave the dialog, select Cancel.
If you intend to run SSSD and Winbind simultaneously (such as when joining via SSSD, but then running a Samba file server), the Samba option kerberos method should be set to secrets and keytab in smb.conf. The SSSD option ad_update_samba_machine_account_password should also be set to true in sssd.conf. These options prevent the system keytab from going out of sync.
Join VM to the managed domain using Winbind
To join the managed domain using winbind and the Windows Domain Membership module of YaST, complete the following steps:
In YaST, select Network Services > Windows Domain Membership.
Enter the domain to join at Domain or Workgroup in the Windows Domain Membership screen. Enter the managed domain name, such as aaddscontoso.com.
To use the SMB source for Linux authentication, check the option for Use SMB Information for Linux Authentication.
To automatically create a local home directory for managed domain users on the VM, check the option for Create Home Directory on Login.
Check the option for Offline Authentication to allow your domain users to sign in even if the managed domain is temporarily unavailable.
If you want to change the UID and GID ranges for the Samba users and groups, select Expert Settings.
Configure Network Time Protocol (NTP) time synchronization for your managed domain by selecting NTP Configuration. Enter the IP addresses of the managed domain. These IP addresses are shown on the Properties window in the Microsoft Entra admin center for your managed domain, such as 10.0.2.4 and 10.0.2.5.
Select OK and confirm the domain join when prompted for it.
Provide the password for an administrator in the managed domain and select OK.
After you have joined the managed domain, you can sign in to it from your workstation using the display manager of your desktop or the console.
Join VM to the managed domain using Winbind from the YaST command line interface
To join the managed domain using winbind and the YaST command line interface:
By default, users can only sign in to a VM using SSH public key-based authentication. Password-based authentication fails. When you join the VM to a managed domain, those domain accounts need to use password-based authentication. Update the SSH configuration to allow password-based authentication as follows.
Open the sshd_conf file with an editor:
Bash
sudo vi /etc/ssh/sshd_config
Update the line for PasswordAuthentication to yes:
config
PasswordAuthentication yes
When done, save and exit the sshd_conf file using the :wq command of the editor.
To apply the changes and let users sign in using a password, restart the SSH service:
Bash
sudo systemctl restart sshd
Grant the 'AAD DC Administrators' group sudo privileges
To grant members of the AAD DC Administrators group administrative privileges on the SLE VM, add an entry to the /etc/sudoers. Once added, members of the AAD DC Administrators group can use the sudo command on the SLE VM.
Open the sudoers file for editing:
Bash
sudo visudo
Add the following entry to the end of /etc/sudoers file. The AAD DC Administrators group contains whitespace in the name, so include the backslash escape character in the group name. Add your own domain name, such as aaddscontoso.com:
config
# Add 'AAD DC Administrators' group members as admins.
%AAD\ DC\ Administrators@aaddscontoso.com ALL=(ALL) NOPASSWD:ALL
When done, save and exit the editor using the :wq command of the editor.
Sign in to the VM using a domain account
To verify that the VM successfully joined to the managed domain, start a new SSH connection using a domain user account. Confirm that a home directory is created, and that group membership from the domain is applied.
Create a new SSH connection from your console. Use a domain account that belongs to the managed domain using the ssh -l command, such as contosoadmin@aaddscontoso.com and then enter the address of your VM, such as linux-q2gr.aaddscontoso.com. If you use the Azure Cloud Shell, use the public IP address of the VM rather than the internal DNS name.
This module introduces the management of users and groups using Active Directory, and compares the differences between Active Directory Services and Microsoft Entra ID.