Skip to content

How to Configure a Group Managed Service Account for an Application Print

  • 0

A group Managed Service Account (gMSA) gives a compatible Windows application a domain identity whose password is managed by Active Directory. It removes a recurring manual password-maintenance task, but it does not automatically grant application permissions or make an unsupported application compatible. A successful deployment proves three separate things: the host can retrieve the managed password, the service can start as the account and the application can access only its intended resources.

The example uses gmsaOrders in the illustrative domain example.internal, with APP01 as the first authorized host. Substitute your own names, organizational units and delegated administrators. Use a separate gMSA for a distinct application security boundary instead of sharing one powerful identity across unrelated services.

Confirm application and domain readiness

Get the application's explicit support requirements for gMSA operation. Services using Service Control Manager, compatible IIS application pools and supported scheduled tasks can use managed identities, but an installer that insists on storing a manually entered password may need a vendor-specific procedure. Do not enter a made-up password to bypass such a check.

Confirm supported domain and forest functional levels, suitable domain controllers, healthy replication, DNS and synchronized time. Install the Active Directory management tools on the management computer as needed. The administrators creating the account need the appropriate delegated directory permissions; the application service does not need Domain Admin membership.

Check whether the forest already has a Key Distribution Service root key. From an appropriately authorized management context:

Get-KdsRootKey
Get-ADDomain | Select-Object DNSRoot,DomainMode
Get-ADForest | Select-Object RootDomain,ForestMode

Do not create a new root key for every application. If no suitable key exists, use the approved forest-change procedure to create one and allow the required convergence time:

Add-KdsRootKey -EffectiveImmediately

Despite the parameter name, production deployment must allow the documented replication safety period, commonly up to ten hours. Backdating a new root key to avoid the wait is a laboratory shortcut, not an appropriate way to accelerate a production change. Preserve the creation evidence and confirm replication before attempting application cutover.

Create an explicit host authorization group

Create a security group whose membership consists of the computer accounts allowed to use the gMSA. This is an authorization boundary: a host permitted to retrieve the managed password can act as that service identity. Do not use Domain Computers or a large convenience group unless every member is intentionally trusted for that application.

New-ADGroup -Name 'GG-gmsaOrders-Hosts' `
    -GroupScope Global -GroupCategory Security
Add-ADGroupMember -Identity 'GG-gmsaOrders-Hosts' `
    -Members (Get-ADComputer APP01)

Place the group in the organization's intended OU when creating it; the shortened example uses the command's default path. Review membership and assign an owner. If hosts are newly added to the group, arrange the supported computer-token refresh process, commonly a planned restart, before testing password retrieval. Directory replication and an old machine security context can otherwise make a correct configuration appear broken.

Create the gMSA and inspect its properties

Create the account with the authorization group rather than a broad list of principals:

$hosts = Get-ADGroup 'GG-gmsaOrders-Hosts'
New-ADServiceAccount -Name gmsaOrders `
    -DNSHostName gmsaOrders.example.internal `
    -PrincipalsAllowedToRetrieveManagedPassword $hosts
Get-ADServiceAccount gmsaOrders `
    -Properties PrincipalsAllowedToRetrieveManagedPassword,ServicePrincipalNames

Use a name unique within the forest. Record the account's purpose, owner and authorized hosts. The DNSHostName property is an account attribute, not a command to create every DNS record the application might require. DNS aliases and service principal names must follow the application's actual connection names.

If the application accepts inbound Kerberos authentication, determine the required SPNs and their correct owner before changing them. Check for duplicates with the approved directory tools. Registering an HTTP or database SPN on the wrong account can cause authentication failures, and broad delegation should never be enabled merely to make a double-hop scenario work.

Install and test on the application host

On APP01, use an elevated session with the ActiveDirectory module available:

Import-Module ActiveDirectory
Install-ADServiceAccount -Identity gmsaOrders
Test-ADServiceAccount -Identity gmsaOrders

The expected test result is True. A false result means the host/account relationship is not ready; do not proceed by granting the gMSA administrative rights. Check host-group membership, replication, computer security context, KDS readiness, domain connectivity and time. The test validates account usability on that host, not every permission the application will need.

Confirm that the application's startup and recovery behavior tolerates the domain connectivity it needs, including a server restart during a planned maintenance test. Repeat host installation and testing on every intended node. A successful test on APP01 does not establish that APP02 is authorized or can reach a suitable domain controller. For a multi-instance application, confirm the vendor's support for sharing the identity across those instances.

Grant application permissions separately

List required local folders, registry keys, shares, databases and certificate private keys. Grant the narrow rights the application requires to EXAMPLE\gmsaOrders$ or a purpose-specific resource group. The trailing dollar sign is part of the account name used in service identity configuration. Do not make the account a local administrator because one data directory initially returns access denied.

Review Log on as a service or the appropriate task logon right and any governing domain policies. A local assignment can be replaced by Group Policy, and an explicit deny can override an allow. Use the workload's supported installation method and effective policy to establish the required logon rights.

For network resources, check both sides of the authorization chain. Access to an SMB path depends on share and NTFS permissions; database access needs the correct login and database authorization. A successful service startup can therefore coexist with a failed business transaction.

Cut over the service in a maintenance window

Record the current service identity and a workable rollback method before changing it. For a traditional password-based identity, confirm that its secret is recoverable through the approved vault process without exposing it in scripts or logs. Stop the application cleanly, configure its logon identity as EXAMPLE\gmsaOrders$ using the vendor-supported interface and leave password entry blank where that interface supports gMSAs.

Start the service and inspect its configured identity and process behavior. Check Service Control Manager events, the application log and the application's own health endpoint or transaction. For IIS, follow the documented application-pool identity method rather than assuming the Windows Services dialog applies to every hosting model.

Exercise an operation that touches each important external dependency. For example, an order-processing service should read its configuration, connect to the database and write its intended output. Test authentication using the real service name when Kerberos matters; an interactive administrator connecting by a different name is a different security context.

Diagnose failures and retire the old account carefully

A logon failure points toward account usability or logon-right policy. Access denied after startup usually points toward resource authorization. A Kerberos error points toward names, SPNs, time or authentication design. Keep those investigations separate so the remedy remains proportional to the fault.

If cutover fails, restore the previous service configuration and verify the application before removing the new account. Do not delete the gMSA while another host still uses it. Once the new identity is proven, remove unused permissions and retire the previous identity according to the organization's retention process. Review the host authorization group whenever servers are rebuilt or decommissioned.

Microsoft documents gMSA management and the KDS root-key requirements; use those references for the directory-level prerequisites.

Related procedures

How to Configure a Dedicated Service Account for a Windows Application; How to Create a Scheduled Application Maintenance Task; How to Audit Active Directory Group Membership Changes.


Was this answer helpful?

« Back