0

I am trying to create a new Azure Key Vault secret using the Azure Cli v2.9.0 (we use this version in our pipelines and upgrading would be difficult at the moment.) via the command below,

az keyvault secret set --vault-name $myKeyVaultName -n $mySecretName --value "abc^def" 

The command is accepted and a new secret is created but it drops the caret (^) from the string and results in a secret value of abcdef instead of the intended abc^def.

enter image description here

During my testing I have seen the below message from Powershell but it's very rare : Unable to encode the output with cp1252 encoding. Unsupported characters are discarded.

Strange as tjhe caret is in the character set - https://en.wikipedia.org/wiki/Windows-1252#Code_page_layout

Is there a way to run this command and get Key Vault to accept the value with the caret?

Phil Murray
  • 6,396
  • 9
  • 45
  • 95

2 Answers2

2

I can reproduce your issue.

enter image description here

Actually, it depends on your environment, this issue just occurs when you run the command in Powershell, if you run the CLI command in Bash, it works fine.

az keyvault secret set --vault-name joykeyvault -n testkey12 --value "abc^def"

enter image description here

So if you want to run this command in Powershell environment, just use the line below.

az keyvault secret set --vault-name joykeyvault -n testkey12 --value '"abc^def"'

enter image description here

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
0

If you have any special value to store in AKV please use double quote under single quote '"abcx^09|"' instead of "abcx^09|"

AKV Stored Value = abcx^09|

Jai Nath Gupta
  • 221
  • 2
  • 7