Closed jnury closed 6 years ago
Great catch, Julien. The main rationale for using RunAsUser is that GroupManagedServiceAccount is not a valid member of a PSSessionConfiguration object if there isn't one configured. However, since PowerShell gracefully handles accessing non-existent properties, your proposed change seems fine.
RunAsUser also addressed an edge case where a static runas user (regular AD user account) was configured for an endpoint. It would trigger the DSC test to fail and re-deploy the endpoint using the correct runas account based on the DSC config. Since you can't really end up in this state with an endpoint deployed with our DSC configuration (only if you manually modify the endpoint), I don't see this as a huge concern.
@jnury this merge caused test() to incorrectly return false when GMSA is not set, my mod:
block not entered if both $currentInstance.GroupManagedServiceAccount & $this.GroupManagedServiceAccount null, this matters because $null -replace '\$$', '' will return an empty string not $null
if (($currentInstance.GroupManagedServiceAccount) -or ($this.GroupManagedServiceAccount)) {
if($currentInstance.GroupManagedServiceAccount -ne ($this.GroupManagedServiceAccount -replace '\$$', ''))
{
Write-Verbose ('GroupManagedServiceAccount not equal: "{0}"' -f $($currentInstance.GroupManagedServiceAccount))
return $false
}
}
@djwork you are absolutely right ! I'll fill a new issue and submit a PR.
Correction as proposed by @djwork. Thank you !
Hi,
On a Windows Server 2012 R2 with WMF 5.1:
I successfully setup a JEA endpoint with the following DSC configuration:
But Test-DSCConfiguration returns False:
If I modify the config as the following (to match the Get-DSCConfiguration value):
The Test-DSCConfiguration returns True, but the endpoint doesn't work . Enter-PSSession from another host fails with error: The verification of the Managed Service Account failed with error 1326
That's because the RunAsUser is misspelled:
Note that I get exactly the same behavior if I manually register PSSessionConfiguration with the trailing $ sign in GroupManagedServiceAccount parameter.
Hope it's clear ... Have a nice day.