Cant access secrets in scripts and endpoints

Product: PowerShell Universal
Version: 5.1.2

Hi,

Im unable to access secret strings in scripts and endpoints, all im trying to do is:

$test = $secret:MySecret
Write-Host $test

This just returns nothing, and ive confirmed that $test is NULL.
If i do something similar in an app and just have it print with Show-UDToast it works. Same environment, same tags, same roles. The only difference is that its an app.

They are being stored in a database (SQL server) and i can see the entries in the variables table. I did read somewhere that you had to set the variable again after creating them but that doesn’t seem to be the case here.

Do you have a role set on the secret?

I do, its set to admin, same as the script.

I ask because if the secret has roles and those roles cannot be determined by the caller, they won’t be accessible. For example, if the caller of the API does not have the admin role, then the secret will not be accessible in the API.

I’m testing this within scripts predominantly, running as an admin user in a DEV environment. I’ve removed the role from the variable and get the same issue.

Every test im doing is through the portal directly.

Ok it works if i remove the role from both the script and the variable. If a have a role set on either or both it fails to retrieve the secret