-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gmsa when installing agent #44
Comments
Is it as straightforward as not passing |
@jwittner, I tried creating a PSCredential object with an empty string as password and convertto-securestring disallows it, resulting in a null $LogonCredential parameter. Looking at the existing logic below, a non-null $LogonCredential parameter is utilized for detecting intent to run as service by specifying This feels really icky, but what if we supply a new optional switch parameter if ( $LogonCredential ) {
if (($PSBoundParameters.ContainsKey('UseGMSA') -or $UseGMSA)
{
$configArgs += '--windowsLogonPassword', `
[System.Net.NetworkCredential]::new($null, $LogonCredential.Password).Password
}
} An alternative to the introduction of |
This Stack Overflow has a suggestion that worked for me. $mycreds = New-Object System.Management.Automation.PSCredential("username", (New-Object System.Security.SecureString)) |
Thanks @jwittner. Doesn't look like we'll need any new parameter to use GMSA but simply a new documented way to create if ($LogonCredential ) {
$NetworkCredential = [System.Net.NetworkCredential]::new($null, $LogonCredential.Password)
if (-not [string]::IsNullOrEmpty($NetworkCredential.Password))
{
$configArgs += '--windowsLogonPassword', $NetworkCredential.Password
}
} |
Pretty close, but we don't need to convert to test the length, and there's a handy if ($LogonCredential -and $LogonCredential.Password.Length -gt 0) {
$configArgs += '--windowsLogonPassword', $LogonCredential.GetNetworkCredential().Password
} |
@jwittner, would you be ok if I combine checks involving $LogonCredential? For example, instead of making change as suggested above: I place them closer together as shown below: I'd like to add Write-Verbose statements so I could tell which way the agent is being configured and consolidating them in this block makes code easier to read. |
That change would lose the print of the logon account, valuable information, in the I like the verbose statements you're adding though - might still test the password where the account is added to |
@jwittner, Install-VSTSAgent function currently supports installation of agents as a Windows service when LogonCredential parameter is set. We would like to deploy it without needing to provide passwords. GMSAs provide the ability to run Windows services without having to provide/rotate passwords and agent now supports it since this update. I'd like to propose adding this feature to Install-VSTSAgent but before that, would prefer to discuss how to do so with maintainers.
The text was updated successfully, but these errors were encountered: