Reputation: 33698
I want to set the secret value with a URL that contains "&", for example: http://ttt.com?p=p&data=1. But "&" is the key word of powershell, so after calling
$v="http://ttt.com?p=p&data=1"
az keyvault secret set --vault-name "XXX" --name "XXX" --value "$v"
The actual value will be http://ttt.com?p=p
.
I tried it with single quotation $v='http://ttt.com?p=p&data=1' or $v="http://ttt.com?p=p`&data=1", both of them don't work.
Upvotes: 3
Views: 729
Reputation: 1723
Try surrounding the ampersand with double quotes. For example:
PS C:\Users\Adriano> $v = 'http://ttt.com?p=p"&"data=1'
PS C:\Users\Adriano> az keyvault secret set --vault-name "adriano-testvault" --name "my-secret" --value $v
{
"attributes": {
"created": "2018-09-20T08:35:25+00:00",
"enabled": true,
"expires": null,
"notBefore": null,
"recoveryLevel": "Purgeable",
"updated": "2018-09-20T08:35:25+00:00"
},
"contentType": null,
"id": "https://adriano-testvault.vault.azure.net/secrets/my-secret/be022c3cfe034bfb83321a35a5919ccf",
"kid": null,
"managed": null,
"tags": {
"file-encoding": "utf-8"
},
"value": "http://ttt.com?p=p&data=1"
}
Upvotes: 4