Enter the account name with a $ on the end and leave the password empty. Windows fetches the password itself.
For a Windows service
Whereservices.msc›the service›Properties›Log On›This account
- Enter the account
Type
CONTOSO\svc-app-gmsa$, with the dollar sign. - Clear both password boxes
Leave them empty and select OK. Windows grants the account the right to log on as a service.
- Restart the service
For a scheduled task
CON-APP-01
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-File C:\Scripts\nightly.ps1" $trigger = New-ScheduledTaskTrigger -Daily -At 2am $principal = New-ScheduledTaskPrincipal -UserId "CONTOSO\svc-app-gmsa$" -LogonType Password Register-ScheduledTask -TaskName "Nightly job" -Action $action -Trigger $trigger -Principal $principal
The account also needs the Log on as a batch job right on that server, set in Local Security Policy or by Group Policy. The Task Scheduler window cannot pick a gMSA, so use PowerShell.
For the Entra Cloud Sync agent
The Cloud Sync guide makes its own account, svc-entra-gmsa, the same way. On the installer's Configure Service Account screen, choose Use custom gMSA and enter ad.contoso.com\svc-entra-gmsa$. Install the agent has the full steps.
Give it only what it needs
- Grant the gMSA rights on the folders or shares its service uses. Leave it out of Domain Admins.
- Use one gMSA per service.
- List what you have with
Get-ADServiceAccount -Filter *and review it each term.
Done when
Check
The service or task runs, and its account shows as CONTOSO\svc-app-gmsa$.


