Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get-AzureStorageFile not listing directory contents unless I pipe it to same cmdlet

I have an azure storage share called myshare with a structure like this:

/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

When I try to list the files using this command

Get-AzureStorageFile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates'

I just get a result listing the directory itself:

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

Type                Length Name    
----                ------ ----   
                         1 ReportTemplates   

Adding a trailing / doesn't help. I'm certain this used to list the files beneath that path (as I have semi-automated steps documented including this command), but no more. Perhaps this is a change in v1.0?

The documentation for Path param says

Specifies the path of a folder. This cmdlet lists the files under the folder that this parameter specifies.

And the example given suggests it should work. Same thing applies if I try to get a listing of just the 3.3.0.22 directory: I'm just given output listing the 3.3.0.22 directory itself.

I've found if I pipe the output to Get-AzureStorageFile (i.e. the same cmdlet again) it gives what I'd expect. But this seems wrong?

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 

I have moved workstations since I last used these commands so it's possible there's something environmental affecting this ... but I don't know what that would be.

Running (Get-Module -Name Azure).Version reports version 1.0.2.-1

Running get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | select-object * gives the output below ... which feels like it's the wrong type being returned:

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
like image 282
Rory Avatar asked Dec 12 '25 14:12

Rory


1 Answers

There's a bug in the current version of the Azure Powershell cmdlets. "Get-AzureStorageFile -Share $s -Path folderpath" should definitely return the files in the folderpath. I asked Gaurav Mantri about this, and he looked into the code, and found that the cmdlet is making a "Head" request to get the properties of the directory, and not fetching the files.

I've reported this on github, so hopefully it will be fixed soon.

like image 73
Robin Shahan - MSFT Avatar answered Dec 15 '25 05:12

Robin Shahan - MSFT