Create Azure Key Vault Secrets with Azure CLI drops caret ^ character in value

感情迁移 提交于 2021-01-07 06:32:53

问题


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.

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?


回答1:


I can reproduce your issue.

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"

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"'



来源:https://stackoverflow.com/questions/65199856/create-azure-key-vault-secrets-with-azure-cli-drops-caret-character-in-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!