Secrets with "-" in the name

avatar
Product: PowerShell Universal
Version: 4.3.0


Hi,

Quick question - we have several secrets with “-” in the name, and when we attempt to retrieve them using the normal way ($Secret:Secret-Name), then it dosent work.

How can i retrieve the secrets, if the name of the secrets contains a “-” ?

avatar
(anonymous user)

Recommended Answer

Found the fix - for anyone else, with the same issue

$(Get-ChildItem -Path "Secret:$($locallogin.SecretName)")


All Comments (2)

avatar

Found the fix - for anyone else, with the same issue

$(Get-ChildItem -Path "Secret:$($locallogin.SecretName)")


avatar

This was already answered in another users’s post, by Adam.

You can use this syntax for hyphenated variable names. ${Secret:Test-Variable}