Working with Managed Service Accounts in Active Directory

Listen to this Post

Featured Image
Managed Service Accounts (MSAs) in Active Directory (AD) provide automatic password management for services, reducing administrative overhead. To use them effectively, you must first generate a Key Distribution Services (KDS) root key using PowerShell.

Key Command:

Add-KdsRootKey –EffectiveTime ((get-date).addhours(-10))

This command ensures that AD can respond to MSA requests by backdating the key’s effective time.

You Should Know:

1. Creating a Managed Service Account

After generating the KDS root key, create an MSA:

New-ADServiceAccount -Name "MyMSA" -DNSHostName "myserver.domain.com" -PrincipalsAllowedToRetrieveManagedPassword "MyServer$"

2. Assigning the MSA to a Service

Install the MSA on the target server and assign it to a service:

Install-ADServiceAccount -Identity "MyMSA" 
Set-Service -Name "MyService" -Credential (Get-Credential "DOMAIN\MyMSA$") 

3. Verifying MSA Functionality

Check if the MSA is correctly installed:

Test-ADServiceAccount -Identity "MyMSA" 

4. Linux Equivalent (Using Samba & Kerberos)

For Linux systems integrated with AD:

net ads keytab ADD MyMSA\$ -k 
kinit MyMSA\[email protected] 

5. Troubleshooting

If MSA requests fail:

  • Confirm the KDS root key exists:
    Get-KdsRootKey 
    
  • Ensure time synchronization (w32tm /resync on Windows, `ntpdate` on Linux).

What Undercode Say:

Managed Service Accounts simplify service authentication but require proper AD configuration. The KDS root key is essential for MSA functionality. Always verify time synchronization in hybrid environments, as Kerberos is time-sensitive.

For security, restrict MSA permissions using PrincipalsAllowedToRetrieveManagedPassword. In Linux, ensure Samba and `krb5` configurations match AD policies.

Expected Output:

 Successful KDS root key creation 
KeyId : 00000000-0000-0000-0000-000000000000 
EffectiveTime : 5/26/2025 2:00:00 AM 
RootKeyVersion : 1 

Reference:

Microsoft Docs – Managed Service Accounts

Prediction:

As hybrid cloud environments grow, MSAs will become critical for automated credential management, reducing manual password rotations and improving security. Expect tighter integration with Azure AD and Linux-based services.

References:

Reported By: Daniel Scheidt – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram