Solved: After migrating from v4 to v5, secrets wipe on service restart

Product: PowerShell Universal
Version: 5.5.3

I’m attempt to migrated to PSU v5, and I’m running into trouble with Secrets. In v4, I used to stage secrets in variables.ps1 like this:

New-PSUVariable -Name 'MySecret' -Vault 'PSUSecretStore' -Type 'System.String'

Then I would set the secret through the admin console, and it would persist.

When I do that in v5, I can set the secret and confirm it has been set:

Id                  : 18
Name                : MySecret
Value               : 
UserName            : 
Password            : 
Secret              : True
Vault               : PSUSecretStore
Type                : System.String
Description         : 
MissingSecret       : False
DisableRunAsSupport : False
DeleteSecret        : False
ReadOnly            : False
Database            : False
Role                : 
Scope               : Global
Tags                : {}
Tag                 : {}
Roles               : 
Force               : False
Module              : 
Required            : False
PasswordNotRequired : False
DisplayValue        : 

When I restart the service, MissingSecret is set to True:

Id                  : 18
Name                : MySecret
Value               : 
UserName            : 
Password            : 
Secret              : True
Vault               : PSUSecretStore
Type                : System.String
Description         : 
MissingSecret       : True
DisableRunAsSupport : False
DeleteSecret        : False
ReadOnly            : False
Database            : False
Role                : 
Scope               : Global
Tags                : {}
Tag                 : {}
Roles               : 
Force               : False
Module              : 
Required            : False
PasswordNotRequired : False
DisplayValue        : 

Is this expected behavior? How are you managing secrets in v5?

I changed the vault to Database and the secrets persist now.

Seems like a bug. Maybe file an issue on the GitHub repo about it. You should be able to use any of the options listed to store secrets.