1

I am trying to upload a csv file to azure file share. Below is the cmdlets I am using:

$folderPath="/"
$ctx=(Get-AzStorageAccount -ResourceGroupName 'rg-aexch' -Name 'storaexch').Context  
$fileShare = Get-AZStorageShare -Context $ctx -Name "fs-aexch"
Set-AzStorageFileContent -Share $fileShare -Source "E:\ Exc\dash\batch1.csv" -Path $folderPath -Force

But I am getting the below error:

Set-AzStorageFileContent : Cannot bind parameter 'Share'. Cannot convert the "Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare" value of type "Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare" to type "Microsoft.Azure.Storage.File.CloudFileShare". At line:13 char:37

  • Set-AzStorageFileContent –Share $s –Source $localFile
    
  •                                 ~~
    
    • CategoryInfo : InvalidArgument: (:) [Set-AzStorageFileContent], ParameterBindingException
    • FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageFileContent
  • 4
    got it working : Set-AzStorageFileContent -Sharename $fileShare.Name -context $ctx -Source "E:\ Exc\dash\batch1.csv" -Path $folderPath -Force – Biswajeet Kumar Oct 28 '21 at 07:44

0 Answers0