Create a group for the servers that may use the account, then the account itself. The group makes it easy to add a second server later.
Create the host group
Members are computer accounts, so each name ends with $.
A domain controller
$top = "OU=Contoso School,DC=ad,DC=contoso,DC=com" New-ADGroup -Name "SG-CON-App-Hosts" -GroupScope Global -GroupCategory Security ` -Path "OU=CON-Groups,$top" -Description "Servers allowed to use svc-app-gmsa" Add-ADGroupMember -Identity "SG-CON-App-Hosts" -Members "CON-APP-01$"
Create the gMSA
A domain controller
New-ADServiceAccount -Name "svc-app-gmsa" ` -DNSHostName "svc-app-gmsa.ad.contoso.com" ` -PrincipalsAllowedToRetrieveManagedPassword "SG-CON-App-Hosts" ` -Path "OU=CON-Service-Accounts,$top" ` -Description "Runs the application service on CON-APP-01"
| Setting | What it does |
|---|---|
| Name | The account name. Keep it to 15 characters or fewer, so older systems can read it. Windows adds a $ on the end. |
| DNSHostName | Required. Use the account name followed by your AD domain. |
| PrincipalsAllowedToRetrieveManagedPassword | The group whose member servers may fetch the password. |
| Path | Puts it in your service accounts OU, not the default container. |
Check it
A domain controller
Get-ADServiceAccount -Identity "svc-app-gmsa" -Properties PrincipalsAllowedToRetrieveManagedPassword, DistinguishedName | Select-Object Name, Enabled, DistinguishedName, PrincipalsAllowedToRetrieveManagedPassword
Naming
Start service accounts with svc- and say what they run, such as svc-app-gmsa, svc-backup-gmsa or svc-entra-gmsa. Give each service its own account, so one compromised server exposes one service.
Done when
Check
The account shows Enabled True in CON-Service-Accounts, with SG-CON-App-Hosts as the group allowed to retrieve its password.


