Every Active Directory domain has a folder like this one. A share called deploy, a handful of scripts, and somewhere in the middle a line that mounts a drive or starts a service, complete with a password in plain text. The password has not changed in years, because nobody can say with certainty what would stop working if it did. Somewhere in the same domain sits an account named svc_backup or svc_report that has never expired, has never logged on interactively, and, according to the last audit, holds far more rights than the job requires.
The group managed service account, or gMSA, was built to end this pattern. Introduced with Windows Server 2012, it is an Active Directory object whose password the domain itself generates, stores, and rotates on a schedule. No person sets that password, no script contains it, and no configuration file needs it. The machines authorized to run a workload fetch the current value from the domain at runtime and log the service on with it. What follows is how the mechanism works, where it fits, where it does not, and how to find the accounts that deserve conversion.
The Path From Handy Script Line to Audit Finding
The classic service account starts life as an ordinary user account. An administrator creates it, clears the flag that forces a password change, ticks "Password never expires", grants the right to log on as a service, and installs the application under that identity. It works. The trouble is everything that happens around it.
Rotation is the first casualty. Changing the password means finding every copy: the service configuration on each server, the scripts in the deploy share, the connection strings, the runbook nobody has opened in years. Miss one copy and a Monday morning outage follows. Most organizations respond by not rotating at all, and a password that was weak when chosen stays that way for a decade.
The second casualty is hygiene. Because someone must paste the password somewhere for the service to use it, copies accumulate in scripts, config files, ticket notes, and installation documents. Service accounts also tend to collect rights over the years, a permission granted for one migration and never removed. Auditors who look for accounts with non-expiring passwords, no interactive logon history, and membership in privileged groups rarely come back empty-handed.
Attackers notice the same pattern. An account that never rotates, never signs in to a console, and answers to well-known service names is a predictable target, and attacks that request service tickets and work on the password offline remain effective because those passwords are old, shared, and human-made. None of this is a failure of diligence; it is what happens when a design requires a person to know a secret and a machine to reuse it forever.
The Group Managed Service Account in One Picture
A gMSA flips the ownership of the password. The account object lives in Active Directory like any other security principal, but its password is not chosen by anyone. The domain computes it, holds it in encrypted form, and replaces it automatically on a schedule, every 30 days by default. The generated value is 240 characters long, which places brute-force work outside any realistic budget.
When a service configured with the account starts, the operating system on the authorized machine asks a domain controller for the current password, receives it, and logs the service on in the background. In the logon dialog of a service, a scheduled task, or an IIS application pool, the entry is simply the account name with a trailing dollar sign, for example CONTOSO\webFarm$, and the password fields stay empty. The dollar suffix matters: tools that validate account names, installer wizards that insist on a password meeting complexity rules, and old scripts that quote the name all need a second look.
The suffix also signals the family the account belongs to. It is the same convention used for machine accounts, the ComputerName$ objects every domain-joined machine already has, and the shared design idea is the same: the domain vouches for the identity, and no person has to remember anything. Where a machine account serves exactly one computer, the managed service accounts extend the idea to workloads. The rotation clock also changes two conversations: security reviews ask which machines may retrieve the password rather than who knows it, and the operations calendar loses a recurring task.
The Machinery Underneath, from Root Key to Runtime Retrieval
Two pieces of plumbing make the automation possible. The first is the KDS root key, created once per forest with the Add-KdsRootKey cmdlet. It is the seed from which the Key Distribution Service on each domain controller derives managed passwords. Password generation is deterministic: given the root key, the account, and the current rotation interval, any domain controller computes the same value. That is why there is no replication traffic for the password itself and no synchronization problem to debug.
The root key needs care at creation time because of replication. Published guidance allows roughly ten hours for the key to become usable across domain controllers, and teams that create the key and the first account on the same afternoon tend to meet a puzzling error instead. Create the key early, let the forest settle, then build accounts.
The second piece is the retrieval list. Every gMSA carries a PrincipalsAllowedToRetrieveManagedPassword setting, which defines which computers may ask for this password. The practical pattern is one security group per workload, with the computer accounts of the nodes that run the service as members. A server outside the list cannot read the value, no matter who is signed on to it. Authorization is explicit and auditable, which the pasted-in-script era never had.
At runtime the flow is short. The node starts the service, Windows contacts a domain controller, presents its membership in the retrieval group, receives the current 240-character password, and completes a background logon as the gMSA. Nothing is typed, nothing is stored in a script, and nothing appears in a config file. The only credential-like fact on the machine is its qualification to fetch the password, and that qualification is managed in Active Directory like any other group membership. Reachability is the hidden requirement: the node needs line of sight to a domain controller when the account is installed, when the retrieval list changes, and in general whenever the workload first logs on after a change.
Standalone Accounts for One Server, Group Accounts for Farms
The dollar-suffix family has two members. The standalone managed service account, introduced with Windows Server 2008 R2, is bound to exactly one computer. It suits a single server running one important service: the password rotates on its own, nothing is stored, and the installation is local to that machine. The account cannot move with the workload and cannot be shared, so the moment a second node needs the same identity, it stops being the answer.
The group managed service account removes that ceiling. Several computers, all listed in the retrieval group, install the same account and run services under one shared identity. The obvious fit is a farm: web servers behind a load balancer that should present one identity to the database, session hosts that run the same scheduled jobs, or an application tier where any node may receive work. One identity means one set of access control entries, one service principal name story for Kerberos, and one account to audit instead of six.
The failover cluster case shows the value most clearly. A clustered service must be able to start on whichever node owns the resource, and with classic accounts that meant either a domain account whose password was stored on every node or a local account with all the synchronization pain that implies. Cluster-aware services accept gMSA identities, so the identity belongs to the cluster role rather than to any machine, and failover happens without anyone touching a password.
Creating and Installing an Account, Command by Command
Once the KDS root key exists in the forest, the work is a matter of creating a retrieval group, creating the account against that group, and installing the account on each node that will run the workload.
New-ADServiceAccount -Name webFarm -DNSHostName webFarm.contoso.com `
-PrincipalsAllowedToRetrieveManagedPassword WebFarmNodes
Install-ADServiceAccount webFarm # run on each node in WebFarmNodes
Test-ADServiceAccount webFarm # True means the node can log the account on
New-ADServiceAccount creates the object in Active Directory, where it appears under the Managed Service Accounts container in the usual consoles. The Name becomes the base of the logon name, which carries a trailing dollar sign, the DNSHostName anchors the service principal name that Kerberos expects, and the retrieval list points at the group holding the computer accounts of the farm. Installation happens per node: Install-ADServiceAccount registers the account locally and confirms the node belongs to the retrieval group. Test-ADServiceAccount is the sanity check, returning True when the node can obtain the password and log on, and a specific error when it cannot.
The cmdlet that ages best is Set-ADServiceAccount. When the farm grows, shrinks, or migrates, the change is an update to the retrieval list followed by installation on the new nodes, and no password is exchanged. The same cmdlet handles later adjustments to descriptions, service principal names, or other properties. The housekeeping is small but real: the account lands in the Managed Service Accounts container by default, creation requires directory rights that can be delegated to the platform team, and installation on a node requires local administrator rights, which keeps a compromised workstation away from the farm's identities. Install and test the account before pointing the service at it, so every rollout step is a verified checkpoint.
The Limits That Surface on Rollout Day
A gMSA is not an interactive account. It cannot sign in to a console or a remote desktop session, by design, so it does not replace administrator or shared support accounts. It runs services, scheduled tasks, and application pools, and that is the boundary.
Application support varies. Microsoft's own server roles, SQL Server, and IIS application pools accept managed service accounts, but third-party installers are inconsistent. Some validate the password field against complexity rules and reject an empty value or a name that ends in a dollar sign. Others keep their own credential store and never hand the logon to Windows. The reliable answer is a test in a lab before cutover, because the failure mode is usually a wizard refusing the name rather than a subtle runtime fault.
Some legacy services still expect plain passwords, and for those the honest choice is to leave them alone or plan around them. An application that connects onward to another system with its own stored credential gains nothing from a gMSA, because the account covers the Windows logon, not the secrets an application keeps internally.
Domain controller reachability shapes the deployment. Installation, changes to the retrieval list, and the first logon of a service after a change all presuppose that the nodes can reach the domain. Branch offices and perimeter networks with limited domain connectivity need a design that accounts for that, through carefully placed domain controllers or by accepting that some workloads stay on classic accounts. One more check: every product in the path, including backup agents and monitoring tools that run as services, must support managed accounts.
Auditing the Domain for Conversion Candidates
Migration works best as a campaign of small wins rather than a single weekend. The first step is an inventory, and Active Directory makes the shortlist easy to produce. A query with Get-ADUser that filters on the never-expires flag and pulls the logon counters alongside returns a list of accounts whose passwords cannot age and whose names no one has signed in with.
From there, the strongest signals that an account is worth converting are these:
- The password is set never to expire and has not changed in living memory;
- There is no history of interactive or remote desktop logons, because the identity runs services rather than people;
- The account is attached to a service, a scheduled task, or an application pool on one machine or on a fixed, documented set of machines;
- Copies of the password exist in scripts, configuration files, or documentation that nobody dares to clean up;
- The account holds rights far beyond the workload's needs, up to and including membership in privileged groups, which is the finding every audit report dreads.
Conversion order matters less than completeness. A common sequence starts with a scheduled task on a test server, moves to a real service, and finishes with application pools. Because a gMSA has its own security identifier, permissions granted to the old account must be re-granted to the new one on every resource the workload touches, so each conversion should carry its own checklist of file shares, database roles, and registry keys. The old account is disabled, kept for a quiet period, and deleted only when the last reference is gone.
Teams that run this campaign usually notice two things. The conversions take less time than the inventory suggested, and the next audit cycle is shorter, because a finding that used to require a remediation project now has a one-line answer. The password lives in the domain, rotates without a calendar invitation, and appears in no script anywhere. The habit of pasting credentials into files ends not because a policy forbade it, but because there is nothing left to paste.