Closed parhodes closed 1 year ago
Verified issue exists in lab. Can update via invoke-tssrestapi but not native command.
Workaround
$body = '{"value": "NEW VALUE"}'
Invoke-TssRestApi -uri ($session.apiurl + "/secrets/$id/fields/$slug") -Body $body -PersonalAccessToken $session.AccessToken -Method put
Command session
PS> Set-TssSecretField -TssSession $session -Id 4046 -Slug notes -Value "Updated Note" -Verbose
VERBOSE: Command invocation: Set-TssSecretField -TssSession:TssSessionObject -Id:System.Int32[] -Slug:notes -Value:Updated Note -Verbose:True
VERBOSE: Performing the operation "PUT https://cloudserver.secretservercloud.com/api/v1/secrets/4046/fields/notes with:
{
"value": "Updated Note"
}
" on target "SecretId: 4046".
VERBOSE: Performing the operation PUT https://cloudserver.secretservercloud.com/api/v1/secrets/4046/fields/notes with:
{
"value": "Updated Note"
}
WARNING: Issue setting field [notes] on secret [4046]
ErrorHandling.ps1: C:\moduledir\thycotic.secretserver\src\functions\secrets\Set-TssSecretField.ps1:184
Line |
184 | . $ErrorHandling $err
| ~~~~~~~~~~~~~~~~~~~~~
| A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than
| the maximum allowed depth of 64. Consider using ReferenceHandler.Preserve on JsonSerializerOptions to support
| cycles. Path:
| $.Members.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.OverloadDefinitions.
VERBOSE: Response for secret [4046]:
PS> Get-TssSecretField -TssSession $session -Id 4046 -Slug notes
notes
PS> Invoke-TssRestApi -uri "https://cloudserver.secretservercloud.com/api/v1/secrets/4046/fields/notes" -Body $body -PersonalAccessToken $session.AccessToken -Verbose -Method put
VERBOSE: HTTP/1.1 PUT with 29-byte payload
VERBOSE: received 14-byte response of content type application/json
VERBOSE: Content encoding: utf-8
Updated Note
PS> Get-TssSecretField -TssSession $session -Id 4046 -Slug notes
Updated Note
PS>
@jagger The Error A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than | the maximum allowed depth of 64. is resolved in latest release. Please verify it again
@parhodes @tylerezimmerman
I am not able to reproduce this issue. this error only reproduceable if secret template does not support the slugname. You can check the below screenshot where secret ID 7072 is Windows Template type which supports the machine name slug and it works well.
below screenshot where secret ID 7040 is Web Password type that does not support the slug name machine name so it will generate the same error what you have recevied.
So please check your secret type.
Verified issue does not already exist?
Yes
What error did you receive
"message": "Secret field is required" although "-slug Machine" defined in command
Please run the command using -Verbose
VERBOSE: Command invocation: Set-TssSecretField -TssSession:TssSessionObject -Id:System.Int32[] -Slug:machine -Value:YYZ0LT0014.[domainName] -Verbose:True VERBOSE: Performing the operation "PUT https://[SSCloudDomain].secretservercloud.com/api/v1/secrets/16660/fields/machine with: { "value": "YYZ0LT0014.[domainName]" } " on target "SecretId: 16660". VERBOSE: Performing the operation PUT https://[SSCloudDomain].secretservercloud.com/api/v1/secrets/16660/fields/machine with: { "value": "YYZ0LT0014.[domainName]" }
C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.61.0\parts\ProcessResponse.ps1 : { "errorCode": "API_RequiredFieldMissing", "message": "Secret field is required" } At C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.61.0\functions\secrets\Set-TssSecretField.ps1:180 char:42
VERBOSE: Response for secret [16660]:
Provide a test case or steps to reproduce
Set-TssSecretField -TssSession $session -Id $secretId -Slug machine -Value $newMachineName -Verbose
Expected behavior
To set the machine name of that secret to the value defined
What Edition of Secret Server?
Cloud Subscription
What version of Secret Server
EA release
What PowerShell host was used when producing this error
Windows PowerShell ISE (powershell_ise)
PowerShell Host Version
Name Value
PSVersion 5.1.14393.5582
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.5582
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1