Powershell error with the below code
Hi Champions,
Can someone please help me with the below powershell code which i want to upload the key vault secrets excel csv file to azure key vault. But it is giving below error.
$keyVaultName = “Test-marketing”
$data = Import-Csv “C:UsersRam.MuppaneniDownloadsmarketing.csv”
# Iterate over each row in the CSV and create/update the secrets in the Key Vault
foreach ($row in $data) {
$secretName = $row.Name
$secretValue = $row.Secretvalue
# Create or update the secret
Set-AzKeyVaultSecret -VaultName $keyVaultName -Name $secretName -SecretValue $secretValue
}
Getting below error:
Line |
6 | … -VaultName $keyVaultName -Name $secretName -SecretValue $secretValue
| ~~~~~~~~~~~~
| Cannot bind argument to parameter ‘SecretValue’ because it is null.
Excel csv file columns and sample data are below three
Name Secretvalue Type
Marketingpassword1kitchen refrigerator password
I would like to add the above column “Type” as well to the code which needs to upload the data to the keyvault along with the Name and Secretvalue.
Please assist.
Looking forward to hear from you.
Cheers,
Ram
Hi Champions,Can someone please help me with the below powershell code which i want to upload the key vault secrets excel csv file to azure key vault. But it is giving below error.$keyVaultName = “Test-marketing”$data = Import-Csv “C:UsersRam.MuppaneniDownloadsmarketing.csv”# Iterate over each row in the CSV and create/update the secrets in the Key Vaultforeach ($row in $data) {$secretName = $row.Name$secretValue = $row.Secretvalue# Create or update the secretSet-AzKeyVaultSecret -VaultName $keyVaultName -Name $secretName -SecretValue $secretValue}Getting below error:Line |6 | … -VaultName $keyVaultName -Name $secretName -SecretValue $secretValue| ~~~~~~~~~~~~| Cannot bind argument to parameter ‘SecretValue’ because it is null.Excel csv file columns and sample data are below threeName Secretvalue TypeMarketingpassword1kitchen refrigerator password I would like to add the above column “Type” as well to the code which needs to upload the data to the keyvault along with the Name and Secretvalue.Please assist. Looking forward to hear from you.Cheers,Ram Read More