Config/Update-TFSConfigFile.ps1
function Update-TFSConfigFile { Param( # JSON string containing configuration keys and values to use [Parameter(Mandatory=$false)] [string] $Config ) if (!(Test-Path (Get-TFSConfigPath))) { New-TFSConfigFile } if ((Get-TFSConfigKeyValue 'collectionUrl') -eq $null) { Set-TFSConfigKeyValue -KeyName 'collectionUrl' -KeyValue 'Azure DevOps collection URL' } if ((Get-TFSConfigKeyValue 'user') -eq $null) { Set-TFSConfigKeyValue -KeyName 'user' -KeyValue 'username' } if ((Get-TFSConfigKeyValue 'password') -eq $null) { Set-TFSConfigKeyValue -KeyName 'password' -KeyValue 'password' } if ((Get-TFSConfigKeyValue 'translationKey') -eq $null) { Set-TFSConfigKeyValue -KeyName 'translationKey' -KeyValue 'translation secret key' } if ((Get-TFSConfigKeyValue 'codeSigningCertThumbprint') -eq $null) { Set-TFSConfigKeyValue -KeyName 'codeSigningCertThumbprint' -KeyValue 'code signing certificate thumbprint' } if ($Config -ne $null) { $ConfigJson = ConvertFrom-Json $Config foreach ($Key in $ConfigJson.PSObject.Properties) { if ((Get-TFSConfigKeyValue $Key.Name) -ne $null) { Set-TFSConfigKeyValue -KeyName $Key.Name -KeyValue $Key.Value } } } } Export-ModuleMember -Function Update-TFSConfigFile |