In Active Directory, Managed Service Accounts (MSAs) are a special type of account used to run Windows services, background apps, and scheduled tasks. MSA account passwords are managed automatically by Active Directory. They are complex and randomly generated, and cannot be used for interactive sign-ins.
Our article covers the following topics:
- basic types of managed accounts in AD
- generating Key Distribution Service Root Key
- creating MSA accounts
- configuring Windows services and scheduled tasks to run under a gMSA
Types of Managed Service Accounts in Active Directory
Key Benefits of Managed Service Accounts
- Simplify the management of service accounts within the AD domain.
- Automated password management: Active Directory randomly generates complex, 240-byte passwords and changes them without any intervention from the admin.
- Increased security: For gMSAs, authorized hosts retrieve the managed password from a DC through LDAP using the msDS-ManagedPassword attribute. Access to the managed password is restricted to authorized principals. This reduces the need for admins to handle service-account passwords manually.
- Managed account security: Managed service accounts use automatically managed credentials and are intended for service workloads rather than interactive sign-ins. Their password management differs from that of regular domain user accounts.
- Multiple host support (gMSA) – allow a single service account to be used across multiple servers running the same service. This includes server farms, clusters, and load balancers.
Types of Managed Service Accounts Supported in Active Directory
Managed service account compatibility depends on the Active Directory schema, domain functional level and forest functional levels, DC versions, and the OSs running the services. The following table summarizes when each account type was introduced and provides current deployment guidance:
| Service account type | Introduced in | Deployment guidance |
|---|---|---|
| sMSA | Windows Server 2008 R2 | Designed for services running on a single server. Supported on compatible Windows Server versions; validate app requirements. |
| gMSA | Windows Server 2012 | Generally preferred for services running on multiple authorized servers. Verify AD requirements and app compatibility. |
| dMSA | Windows Server 2025 | Designed to migrate traditional domain service accounts to managed identities. Requires Windows Server 2025 DC support and compliance with Microsoft’s migration requirements. |
For new deployments, you should prefer gMSA whenever the app supports it, including single-server workloads. Standalone MSAs (sMSAs) remain supported for existing compatible workloads, but gMSA is generally the preferred option for new deployments because it supports both single-server and multi-server cases.
* Keep in mind that Windows Server 2016 reaches the end of extended support on January 12, 2027. For new deployments, you need to prefer a currently supported Windows Server release with a longer remaining support lifecycle.
dMSA Migration Scenarios
Delegated Managed Service Accounts (dMSA), introduced in Windows Server 2025, are a relatively new AD feature designed to simplify the migration from traditional service accounts to managed identities.
Unlike sMSA and gMSA, dMSA does not introduce a new AD domain functional level requirement. Instead, the feature requires at least one Windows Server 2025 domain controller in the domain.
Unlike gMSA, you can use dMSA in migration cases where existing services already run under standard domain user accounts. This helps you to reduce the operational overhead of password management and lowers the risk of credential theft.
Note. One of the primary use cases for dMSA in Windows Server 2025 is migrating existing services from traditional domain service accounts to managed identities with automated credential management.
dMSA Security Considerations. Before deploying dMSA in an enterprise AD environment, you need to ensure that Windows Server 2025 DCs are fully patched and review delegated permissions on the OUs where dMSA objects can be created/modified.
The dMSA implementation introduced security-sensitive AD attributes and delegation paths. In 2025, researchers disclosed the BadSuccessor privilege escalation technique (CVE-2025-53779), which abused dMSA functionality to escalate privileges in AD. Microsoft released security updates to address the original attack path, but the underlying dMSA delegation model remains security-sensitive. Akamai’s post-patch research also described additional attack techniques using the same dMSA primitives.
Therefore, do not treat dMSA deployment as simply enabling a more secure service-account type. Before using dMSA, you should review who has permission to create and modify dMSA objects and related attributes, keep Windows Server 2025 DCs fully patched, and monitor unexpected changes to dMSA objects and their delegation-related attributes.
Basic MSA implementation procedure
A basic gMSA implementation procedure in AD might look like this:
- Create the KDS Root Key (only needed the first time)
- Create a gMSA in the Active Directory and specify the hosts that can use it.
- Install gMSA on the target Windows Server host
- Configure the service, task, or app on the server to use gMSA.
Creating Key Distribution Service (KDS) Root Key
The Key Distribution Service (KDS) on Active Directory domain controllers generates and manages passwords for gMSA accounts. This allows multiple Windows servers to use the same gMSA account, the password for which is only accessible to a specific list of domain computer accounts.
Prerequisites
For gMSA:
- Active Directory PowerShell module
- AD schema updated to support group Managed Service Accounts (gMSAs)
- DCs and domain functional levels that meet Microsoft’s documented requirements for gMSA deployment
- KDS Root Key
- Windows Server member machine
- Time sync working correctly
For dMSA:
- At least one Windows Server 2025 DC
- Fully patched Windows Server 2025 DCs
- Appropriate permissions to create and manage dMSA objects
Before using MSA within a domain, a Key Distribution Service (KDS) Root Key must be generated. This is a one-time procedure for a domain.
Check if the KDS root key has already been created:
Get-KdsRootKey
If the command returns a key ID, you’re done. Otherwise, you need to create a KDS root key:
Note that creating a KDS root key requires appropriate AD permissions. Run this command in an elevated PowerShell session using an account with the required rights to create the key in AD. In a typical delegated/default AD environment, this is performed by a member of Enterprise Admins. Domain Admins membership alone does not necessarily grant the required forest-wide permissions.
Add-KdsRootKey -EffectiveImmediately

Despite the parameter name, the KDS root key is not immediately usable across the domain. We recommend you to wait for normal AD replication to complete before creating production gMSAs. The KDS key will be created and ready to use within 10 hours of replication between the DCs.
You can use the following command in lab/isolated test environments:
Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))
To check for the KDS root key in the Active Directory Sites and Services console, enable View > Show Services Node if the Services node is not visible. Then go to Services > Group Key Distribution Service > Master Root Keys. Alternatively, use the following PowerShell command to check if a KDS root key exists:
$rootKeys = @(Get-KdsRootKey)
if ($rootKeys.Count -eq 0) {
Write-Error "No KDS root key was found."
}
else {
foreach ($key in $rootKeys) {
Test-KdsRootKey -KeyId $key.KeyId
}
}

Important. The KDS Root Key is a critical AD object used to generate gMSA passwords throughout the domain. You should not remove existing KDS Root Keys unless specifically instructed by Microsoft support or as part of a documented recovery procedure. The key is stored in AD and protected by normal AD backup and recovery processes. You need to ensure that Active Directory DCs are regularly backed up.
Creating gMSA Accounts in Active Directory
MSA accounts can be created in Active Directory using PowerShell. I will create a new group Managed Service Account (gMSA) named gmsa_corpHQ that can be used on three Windows Server hosts in the domain. A separate security group, gmsa_corpHQ_Group, will control which computer accounts are authorized to retrieve the gMSA’s managed password. Let’s use the following:
$gMSA = 'gmsa_corpHQ'
$gMSA_Hosts = 'srv01$', 'srv02$', 'srv03$'
Next, let’s create a new security group, and add the target server accounts to it:
$groupOU = 'OU=Service Account Groups,OU=Groups,DC=corp,DC=example,DC=com'
$gMSA_Group = New-ADGroup `
-Name "$($gMSA)_Group" `
-GroupScope Global `
-GroupCategory Security `
-Path $groupOU `
-PassThru `
-ErrorAction Stop
$gMSA_Hosts | ForEach-Object { Add-ADGroupMember -Identity $gMSA_Group -Members $_ }
* Don’t forget to replace the example domain components and OU path with the distinguished name (DN) of an existing OU in your AD. Both Groups and Service Account Groups must exist in the example hierarchy.
The new gMSA account can now be created:
$domainDNSRoot = (Get-ADDomain).DNSRoot
New-ADServiceAccount `
-Name $gMSA `
-DNSHostName "$($gMSA).$domainDNSRoot" `
-PrincipalsAllowedToRetrieveManagedPassword $gMSA_Group `
-KerberosEncryptionType AES128,AES256 `
-ErrorAction Stop

This command will create a new gMSA account and grant members of the gmsa_corpHQ_Group access to the account’s password in AD.
In multi-domain AD forests, you can also use gMSA accounts in more complex enterprise scenarios involving servers located in different domains. In large AD environments, you should review the latest Microsoft guidance for gMSA deployment (including requirements for domain and forest functional levels, KDS Root Key configuration, Kerberos, and SPN management).
By default, MSAs are created in the Managed Service Accounts container (to show them, you need to enable the Advanced Features option in the ADUC console).
The screenshot below shows that a new msDS-GroupManagedServiceAccount object has been successfully created.

List all managed service accounts in AD:
Get-ADServiceAccount -Filter *
Auditing Servers Allowed to Retrieve gMSA Passwords
You should regularly review which servers are allowed to retrieve gMSA passwords. You need to remove decommissioned hosts and check that only authorized computers remain in the approved access list.
In order to view the principals assigned to a specific gMSA account, run the command:
Get-ADServiceAccount gmsa_corpHQ `
-Properties PrincipalsAllowedToRetrieveManagedPassword |
Select-Object -ExpandProperty PrincipalsAllowedToRetrieveManagedPassword
If a security group is used to authorize hosts to retrieve the gMSA password, review its membership, including members of nested groups:
Get-ADGroupMember -Identity 'gmsa_corpHQ_Group' -Recursive
Review the output to verify that only authorized computer accounts can retrieve the gMSA password.
In order to audit all gMSA accounts in the domain, use the following command:
Get-ADServiceAccount -Filter * `
-Properties PrincipalsAllowedToRetrieveManagedPassword |
Select-Object Name, PrincipalsAllowedToRetrieveManagedPassword
Note. You should review these permissions regularly as part of security audits and remove obsolete computer accounts from the approved host list.
Kerberos Encryption and RC4 Compatibility
Windows updates released on and after April 14, 2026, change the default Kerberos Key Distribution Center (KDC) behavior for service accounts without an explicitly configured msDS-SupportedEncryptionTypes attribute. The KDC assumes AES-SHA1 support instead of RC4. Updates released on or after July 2026 remove the temporary rollback mechanism for this change.
This change can affect gMSA-backed services that communicate with legacy apps, Linux systems, NAS devices, or other Kerberos clients that support only RC4. Before deploying a gMSA/changing its encryption settings, you need to check if the service and its clients support AES encryption.
Configuring Kerberos Encryption Types for a gMSA
For services that support AES-SHA1, you can configure the supported Kerberos encryption types when creating a gMSA or update an existing account.
To update an existing gMSA, run:
Set-ADServiceAccount `
-Identity 'gmsa_corpHQ' `
-KerberosEncryptionType AES128,AES256 `
-ErrorAction Stop
Use this setting only after verifying application and client compatibility. Specifying AES encryption types does not make an RC4-only application compatible with AES. Also, verify that the account has the required AES keys and that the service’s SPNs and Kerberos configuration are correct.
For an existing gMSA, review its configured encryption types before making changes:
Get-ADServiceAccount -Identity gmsa_corpHQ `
-Properties msDS-SupportedEncryptionTypes |
Select-Object Name, msDS-SupportedEncryptionTypes
Audit Kerberos Encryption Events
Review the following logs on DCs in order to identify RC4 dependencies and potential authentication failures:
- System log — KDC/KDCSVC events 201–209: identify encryption configs and Kerberos requests that may be affected by the RC4 hardening changes. Events 201 and 202 are audit warnings during the applicable audit phase; events 203 and 204 indicate blocked requests in enforcement mode. Event 205 identifies an insecure DefaultDomainSupportedEncTypes config.
- Security log — events 4768 and 4769: inspect Kerberos authentication and service-ticket events. You need to review the ticket encryption type, account encryption settings, available keys, and advertised encryption types in order to identify RC4 usage.
Do not enable RC4 across the domain as a general workaround. You should prefer migrating/reconfiguring legacy services to support AES. If a service genuinely requires RC4, you need to assess the security implications and follow Microsoft’s guidance for explicitly configuring the affected account.
How to Install Managed Service Account on Windows Server
The next step is to install the MSA account on the server on which it will be used (this requires the RSAT-AD-PowerShell module to be installed):
# If the AD PowerShell module is not installed
Install-WindowsFeature RSAT-AD-PowerShell
Install-ADServiceAccount -Identity gmsa_corpHQ
Note that some Kerberos-enabled apps may require SPN registration when using gMSA accounts.
In order to check if a gMSA already has any Service Principal Names (SPNs) registered, run the command:
Get-ADServiceAccount gmsa_corpHQ -Properties ServicePrincipalNames |
Select-Object -ExpandProperty ServicePrincipalNames
Some apps (such as SQL Server, IIS, or custom Kerberos-enabled services) may require additional SPNs to be registered manually. You should refer to the app’s documentation before modifying SPNs.
Retrieve MSA account credentials from AD
Check that the account has been installed and can retrieve its credentials from AD:
Test-ADServiceAccount gmsa_corpHQ
In case you get True in output, then the account can retrieve credentials.
If you see False in the output, you should verify the following:
- host is in PrincipalsAllowedToRetrieveManagedPassword
- AD replication completed
- KDS root key exists
- account is installed locally
Note that the computer’s Kerberos tickets may still reflect its previous group membership. In case the machine was recently added to the security group authorized to retrieve the gMSA password, you need to restart the server/refresh the Local System Kerberos ticket cache before testing again.
Run the following command from an elevated Command Prompt on the affected server:
klist -li 0x3e7 purge
Then retry the following command in PowerShell:
Test-ADServiceAccount -Identity gmsa_corpHQ
If the test still returns False, you need to verify the machine’s group membership, Active Directory replication, DC connectivity, and the gMSA’s PrincipalsAllowedToRetrieveManagedPassword config.

Configure the target Windows services
Next, configure the target Windows services to run under an MSA account:
- Open the Services Management snap-in (services.msc)
- Open the target service’s properties and go to the Log on tab.
- Select the This account option and enter the MSA account in the format DOMAIN\gmsa_corpHQ$ (the $ sign at the end is required). Leave the password blank

- Restart the service and it should now be running using the gMSA account.
The specification of MSA is not supported by the Task Scheduler GUI, so the task must be created manually. Use the following PowerShell commands to config an existing scheduled task to run under the gMSA account. The task must already exist. If you need to create a new task, you need to register it separately using Register-ScheduledTask.
$Principal = New-ScheduledTaskPrincipal `
-UserID 'DOMAIN\gmsa_corpHQ$' `
-LogonType Password `
-RunLevel Limited
Set-ScheduledTask -TaskName "MSA_TASK1" -Principal $Principal
The Password logon type is required even though no password is specified for a gMSA.
To remove an MSA account from the host:
Uninstall-ADServiceAccount gmsa_corpHQ
Auditing dMSA Delegation Permissions
You need to periodically audit the permissions on OUs containing dMSA objects. Verify that only authorized admins and groups can create/modify these objects, and remove unnecessary permissions such as GenericAll/GenericWrite. You can review delegated permissions in Active Directory Users and Computers or ADSI Edit.
Wrapping Up
Managed service accounts simplify service-account management by automating password management and restricting password retrieval to authorized hosts. Before deploying a gMSA in production, you need to check if the target servers are authorized to retrieve its managed password, test the account with Test-ADServiceAccount, and confirm that the service or scheduled task runs correctly under the gMSA.
