I published an app using Azure CLI with command
func azure functionapp publish [my-app-name] --nozip
Now I want to update the configuration of the app to connect to the Azure Key Vault and get secrets from the Vault. So, I am running this command
az functionapp config appsettings set --name [my-app-name] --resource-group [my-app-res-group] --settings "PublicKey=@Microsoft.KeyVault(VaultName=[vault-name];SecretName=[secret-name])"
this returns an error like this
request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/[my-sub-guid]/resourceGroups/[my-app-res-group]/providers/Microsoft.Web/sites/[my-app-name]/config/appsettings?api-version=2019-08-01 (Caused by ResponseError('too many 500 error responses',))
But the command work fine and publish the setting to the Azure except it publish not
PublicKey=@Microsoft.KeyVault(VaultName=[vault-name];SecretName=[secret-name])
But
PublicKey=@Microsoft.KeyVault(VaultName=[vault-name];SecretName=[secret-name]
Whats the problem with closing ) and what can I do to overcome this issue.
P.S. I know I can do this both from Azure Portal, Visual Studio and VS Code but it's critical for me to do this using commandline tool!
You can have a look at this wiki around quoting issues with PowerShell:
To make it work you have few options:
Add additional double quotes for force powershell to treat the argument as a literal:
az functionapp config appsettings set --name [my-app-name] --resource-group [my-app-res-group] --settings `""PublicKey=@Microsoft.KeyVault(VaultName=[vault-name];SecretName=[secret-name])"`"
Use --%
to stop PowerShell from parsing the argument and escape double quotes
az --% functionapp config appsettings set --name [my-app-name] --resource-group [my-app-res-group] --settings "PublicKey=@Microsoft.KeyVault(VaultName=[vault-name];SecretName=[secret-name])"