powershellpowershell-dsc

Service identity incorrect when set with Service resource


I have a DSC configuration which includes this resource:

Service SQL {
    Name = 'SQLSERVERAGENT'
    StartupType = 'Manual'
    State = 'Running'
    Credential = $c
}

When I run this configuration, the service identity is correct in services.msc but kerberos fails because the SPN is assigned to the new user and the service is still running under whatever the old identity is. When I restart the service, it functions correctly. I don't want to have to make a custom resource with a registry flag to mark it for no further resets, etc.

Can I use this resource to make my service restart only once in order to assume the correct identity?


Solution

  • I have written a script resource that restarts the service and then creates a registry key.