Here is the code along with error i am using. Thanks for the response
$inputfile = Import-Csv C:\BCP\inputcsv.csv
foreach($inp in $inputfile)
{
$Name = $inp.Name
$secretvalue = $inp.secretvalue
$Contenttype = $inp.Contenttype
$Tags = @{$inp.TagName = $inp.TagValue}
$Secret = ConvertTo-SecureString -String $secretvalue -AsPlainText -Force
set-azkeyvaultsecret LTLkeyVault -Name $Name -SecretValue $secret -ContentType $Contenttype -Tag $Tags
}
set-azkeyvaultsecret : 'secretName' does not match expected pattern '^[0-9a-zA-Z-]+$'.
At line:18 char:3
- set-azkeyvaultsecret LTLkeyVault -Name $Name -SecretValue $secret ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : CloseError: (:) [Set-AzKeyVaultSecret], ValidationException
- FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret
set-azkeyvaultsecret : 'secretName' does not match expected pattern '^[0-9a-zA-Z-]+$'.
At line:18 char:3
- set-azkeyvaultsecret LTLkeyVault -Name $Name -SecretValue $secret ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : CloseError: (:) [Set-AzKeyVaultSecret], ValidationException
- FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret