I can run this PowerShell command without any issues:
az keyvault secret set --name myPassword --vault-name myVault --value --% "3vFBJYp/FaH1C|Jr)Ee"
However, this command fails:
PS > az keyvault secret set --name myPassword --vault-name myVault --value --% "-3vFBJYp/FaH1C|Jr)Ee"
'Jr)Ee' is not recognized as an internal or external command,
operable program or batch file.
PS C:\dev\edci\Seq\scripts> az keyvault secret set --name myPassword --vault-name myVault --value --% "-3vFBJYp/FaH1C|Jr)Ee"
argument --value: expected one argument
Notice that the only difference is the leading dash. I've tried several combinations of escaping the dash, but they didn't work or they conflict with other characters. BTW, I settled on the --%
with the password escaped with double-quotes because that performed the best in my tests. Is there anything else I can try?
According to the documentation:
If a parameter's value begins with a hyphen, Azure CLI tries to parse it as a parameter name. To parse it as value, use = to concatenate the parameter name and value: --password="-VerySecret".
so this should work for you:
az keyvault secret set --name myPassword --vault-name myVault --value="-3vFBJYp/FaH1C|Jr)Ee"