Improve PowerShell error messages
Hello,
I found an issue that when calling get-AzKeyVaultSecret from PS, it returns useless error "forbidden". When instead I call az keyvault secret show from Bash, i get error that "IP address *** not allowed".
PS Azure:> Get-AzKeyVaultSecret -vaultname tbtest3-kv
Get-AzKeyVaultSecret : Operation returned an invalid status code 'Forbidden'
At line:1 char:1
+ Get-AzKeyVaultSecret -vaultname tbtest3-kv
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzKeyVaultSecret], KeyVaultErrorException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret
tomas@Azure:~$ az keyvault secret show --name "AppSecret" --vault-name "tbtest3-kv"
Client address (137.117.226.47) is not authorized and caller is not a trusted service
The IP restriction is intentional, but it appears so that Bash tends to return more informative messages on same errors, and as you probably agree, the PS error was useless in identifying the cause.
It would be nice if you enhanced PS error messages to return same information as Bash counterparts - in this case to return the IP address error, which was essential to allow it on the Key vault firewall. :)
Thanks!
