Forum Discussion
Powershell error with the below code
- Aug 26, 2024
Replace the following existing line:
$secretName = $row.$secretNameWith:
$secretName = ConvertTo-SecureString -AsPlainText -String $row.$secretName -Force;The error's telling you that Set-AzKeyValutSecret wants a secure string, not a plain text string.
Cheers,
Lain
oliwer_sundgren
Hi Oliwer,
I got the below output.
But it did not upload the data to key vault.
Looking forward to hear from you. Thank you.
Regards,
Rambo
Could you try and run the script again and share a screenshot of error message again?.
After the script has ran, run $Row.Name in the terminal and see if it outputs something as well
Cheers
Oliwer
- LainRobertsonAug 27, 2024Silver Contributor
The error is telling you that the values for Secretvalue in the XLSX may only contain:
- Numbers (0-9);
- Lowercase letters (a-z);
- Uppercase letters (A-Z);
- The minus/hyphen/dash symbol (-).
Cheers,
Lain
- Rambo363636Aug 27, 2024Brass Contributor
LainRobertson oliwer_sundgren
Hi Lain & OliwerI have edited and ran the below code and now i get the below error.
Please advise the workaround.
Looking forward to hear from you.
Regards,
Rambo - Rambo363636Aug 27, 2024Brass Contributor
LainRobertson oliwer_sundgren
Hi Lain,
I ran the below as advised and received the below output.
Looking forward to hear from you. Thanks.
Regards,
Rambo - LainRobertsonAug 26, 2024Silver Contributor
Replace the following existing line:
$secretName = $row.$secretNameWith:
$secretName = ConvertTo-SecureString -AsPlainText -String $row.$secretName -Force;The error's telling you that Set-AzKeyValutSecret wants a secure string, not a plain text string.
Cheers,
Lain
- Rambo363636Aug 26, 2024Brass Contributor
oliwer_sundgren LainRobertson
Hi Oliwer & Lain,
I ran below and got the below output.
Looking forward to hear from you.
Regards,
Rambo - oliwer_sundgrenAug 23, 2024Iron ContributorLainRobertson
Yeah I noticed that I missed that it said SecretValue in the CSV 🙂 Thanks for clarifying
Cheers! - LainRobertsonAug 23, 2024Silver Contributor
It'd need to be $Data.Secretvalue rather than $Data.Value. Other than that, as you say, the data appears fine now, but wouldn't have at the start given the $null error.
Cheers,
Lain