Removing all Roles from $Secret:Variable makes it unusable. And Get-PSUVariable on secrets does not show the value.
I m running into issues while accessing variables for a while now and I could finally pin down two reproducable issues.
I created 3 Secret variables:
SecTest should now be equivalent to SecTestRoleRem, but turns out, they are not.
Small script to inspect variables:
$names = @("SecTest","SecTestRole","SecTestRoleRem")
$names | ForEach-Object {
Write-Information "Access via Secret:name Secret:$_ :"
Write-Information (Get-ChildItem "Secret:$_")
$PSUVariable = Get-PSUVariable -Name $_
Write-Information ($PSUVariable | ConvertTo-Json)
}Result of the Script:
Access via Secret:name Secret:SecTest :
S123456
{
"Id": 23,
"Name": "SecTest",
"Value": null,
"UserName": null,
"Password": null,
"Secret": true,
"Vault": "Database",
"Type": "System.String",
"Description": null,
"MissingSecret": false,
"DisableRunAsSupport": false,
"DeleteSecret": false,
"ReadOnly": false,
"Database": false,
"Role": null,
"Scope": 0,
"Tags": [],
"Tag": [],
"Roles": null,
"Force": false,
"Module": null,
"Required": false,
"PasswordNotRequired": false,
"SourceModule": null,
"SourceModuleBase": null,
"DisplayValue": ""
}
Access via Secret:name Secret:SecTestRole :
78293479
{
"Id": 26,
"Name": "SecTestRole",
"Value": null,
"UserName": null,
"Password": null,
"Secret": true,
"Vault": "Database",
"Type": "System.String",
"Description": null,
"MissingSecret": false,
"DisableRunAsSupport": false,
"DeleteSecret": false,
"ReadOnly": false,
"Database": false,
"Role": [
"Execute"
],
"Scope": 0,
"Tags": [],
"Tag": [],
"Roles": [
"Execute"
],
"Force": false,
"Module": null,
"Required": false,
"PasswordNotRequired": false,
"SourceModule": null,
"SourceModuleBase": null,
"DisplayValue": ""
}
Access via Secret:name Secret:SecTestRoleRem :
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path 'SecTestRoleRem' because it does not exist.2 Issues:
To add further details, this script:
Write-Information "SecTest"
Write-Information ($Secret:SecTest)
$PSUVariable = Get-PSUVariable -Name "SecTest"
Write-Information ($PSUVariable | ConvertTo-Json)
Write-Information (Get-ChildItem "Secret:SecTest")
Write-Information "SecTestRoleRem"
Write-Information ($Secret:SecTestRoleRem)
$PSUVariable = Get-PSUVariable -Name "SecTestRoleRem"
Write-Information ($PSUVariable | ConvertTo-Json)
Write-Information (Get-ChildItem "Secret:SecTestRoleRem")Should basically handle both secret variables the same, since they are configured the same, but will result in:
SecTest
S123456
{
"Id": 23,
"Name": "SecTest",
"Value": null,
"UserName": null,
"Password": null,
"Secret": true,
"Vault": "Database",
"Type": "System.String",
"Description": null,
"MissingSecret": false,
"DisableRunAsSupport": false,
"DeleteSecret": false,
"ReadOnly": false,
"Database": false,
"Role": null,
"Scope": 0,
"Tags": [],
"Tag": [],
"Roles": null,
"Force": false,
"Module": null,
"Required": false,
"PasswordNotRequired": false,
"SourceModule": null,
"SourceModuleBase": null,
"DisplayValue": ""
}
S123456
SecTestRoleRem
System.Management.Automation.InformationRecord
{
"Id": 28,
"Name": "SecTestRoleRem",
"Value": null,
"UserName": null,
"Password": null,
"Secret": true,
"Vault": "Database",
"Type": "System.String",
"Description": null,
"MissingSecret": false,
"DisableRunAsSupport": false,
"DeleteSecret": false,
"ReadOnly": false,
"Database": false,
"Role": null,
"Scope": 0,
"Tags": [],
"Tag": [],
"Roles": null,
"Force": false,
"Module": null,
"Required": false,
"PasswordNotRequired": false,
"SourceModule": null,
"SourceModuleBase": null,
"DisplayValue": ""
}
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path 'SecTestRoleRem' because it does not exist.
So removing roles from secret variables does break them.
Adding back a role, makes them usable again, until you remove the role again.
And Get-PSUVariable on secrets does not retrieve the value.
PSU Version2026.2.0
@tools-sebi Get-PSUVariable does not return the secret value by design. We do have an issue in our backlog to change that but it would be an opt-in feature.
As for the issue with roles, that appears to be a real issue. I've opened an issue for that and we will be addressing in an upcoming release.
Adam Driscoll
PowerShell Expert and Developer at Devolutions