Closed allan-stewart closed 3 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms
@allan-stewart , thanks for reporting. Do you remember which version of Az.keyvault works?
As far as I know, Get-AzKeyVaultSecret
has a breaking change in the last major release. It returns secure string by default instead of string in previous version. Please try to append -AsPlainText
to get the value in plain text. https://docs.microsoft.com/en-us/powershell/module/az.keyvault/get-azkeyvaultsecret?view=azps-5.6.0#parameters
Adding -AsPlainText
worked (once I also removed the .SecretValueText
from the script). I must have been on the wrong version of the docs somehow, because I didn't see that option to try. Thanks for pointing it out.
As for the older version that worked, I'm not sure. I created it on my old machine before its hard drive died. But the commit for my script was Aug 14, 2020 and I'm quite sure that I installed powershell on my Mac in order to build that script, so it would have been whatever version was most recent at that time (if that even helps).
I understand there are a bunch of different teams involved, but it would be nice if an updated script could be linked from Azure to prevent others from having to figure out the upgrades from AzureRm to Az. But this at least solves my issue, so thank you!
@allan-stewart , thanks for the verification. This breaking change was introduced in the second half of last year because users complained it's not secure if secret shows in plain text. For documentation, we will report it if we find docs are not updated.
Close this issue now.
Description
I am attempting to export an App Service Certificate based on the instructions here which is linked to from portal.azure.com in the "Export Certificate" > "Export App Service Certificate" instructions.
I am on MacOS, so I converted the script to use the Az module some time ago. It worked great. But then I needed to run it again, and now it is failing, apparently because
SecretValueText
is not getting set after a call like:$secret = Get-AzKeyVaultSecret -VaultName $keyVaultName -Name $keyVaultSecretName
When I run that command by itself, it gives me back data about the certificate. So I know it found the certificate correctly, but the
SecretValueText
is always empty.Steps to reproduce
Insert your own values into the following script and try to run it.
Environment data
Module versions
Error output