Get-AzureStorageFile不会列出目录内容,除非我将其通过管道传递到同一cmdlet

Ror*_*ory 3 powershell azure azure-powershell

我有一个名为azure的存储共享myshare,其结构如下:

/3.3.0.22/ReportTemplates/File1.rdl
/3.3.0.22/ReportTemplates/File2.rdl
/3.3.0.22/ReportTemplates/File3.rdl
/3.3.0.22/ReportTemplates/File4.rdl
Run Code Online (Sandbox Code Playgroud)

当我尝试使用此命令列出文件时

Get-AzureStorageFile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates'
Run Code Online (Sandbox Code Playgroud)

我只得到列出目录本身的结果:

   Directory: https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22

Type                Length Name    
----                ------ ----   
                         1 ReportTemplates   
Run Code Online (Sandbox Code Playgroud)

添加尾随/无济于事。我确定这是用来列出该路径下的文件的(因为我记录了包括该命令的半自动化步骤),但没有更多。也许这是v1.0中的更改?

Path参数的文档

指定文件夹的路径。此cmdlet列出此参数指定的文件夹下的文件。

给出的示例表明它应该可以工作。如果我尝试仅获取3.3.0.22目录列表,则同样适用:只是给出3.3.0.22目录列表本身的输出。

我发现是否将输出通过管道传递到Get-AzureStorageFile(即再次使用相同的cmdlet)它可以提供期望的结果。但这似乎错了吗?

get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | get-azurestoragefile


   Directory: https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates

Type                Length Name 
----                ------ ----  
                         1 File1.rdl 
                         1 File2.rdl 
                         1 File3.rdl 
                         1 File4.rdl 
Run Code Online (Sandbox Code Playgroud)

自从我上次使用这些命令以来,我一直在移动工作站,因此可能有环境因素对此产生了影响……但是我不知道那会是什么。

运行(Get-Module -Name Azure).Version报告版本1.0.2.-1

运行get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | select-object *给出下面的输出...感觉就像返回了错误的类型:

ServiceClient : Microsoft.WindowsAzure.Storage.File.CloudFileClient
Uri           : https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates
StorageUri    : Primary = 'https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates'; Secondary = ''
Properties    : Microsoft.WindowsAzure.Storage.File.FileDirectoryProperties
Metadata      : {}
Share         : Microsoft.WindowsAzure.Storage.File.CloudFileShare
Parent        : Microsoft.WindowsAzure.Storage.File.CloudFileDirectory
Name          : ReportTemplates
Run Code Online (Sandbox Code Playgroud)

小智 5

当前版本的Azure Powershell cmdlet中存在一个错误。“ Get-AzureStorageFile -Share $ s -Path folderpath”肯定应该返回folderpath中的文件。我向Gaurav Mantri询问了这一点,他调查了代码,发现cmdlet正在发出“ Head”请求以获取目录的属性,而不是获取文件。

我已经在github上报告了这一点,因此希望它将很快得到修复。