0
votes

I have a storage account storing blobs in the following container structure: Name\Year\Month\Day\Hour

I can use Get-AzureStorageContainer to get a list of all containers, which returns all the 'Names', but I need to drill down to the next level and return all 'Year' containers where name = something.

Does anyone know if this is possible in Azure Powershell?

1

1 Answers

2
votes

Please have a look at the List directories in a container question. It discusses in detail how the hierarchy of containers, directories and files work together in Azure Storage Blob accounts.

But to answer your question. If you want to list all files inside the '2018' folder you can run

$container = "test"
$ctx = New-AzureStorageContext -StorageAccountName $accName -StorageAccountKey $accKey
Get-AzureStorageBlob -Container $container -Context $ctx -Prefix 2018

If you to drill down further you can add that to the prefix, kinda like

Get-AzureStorageBlob -Container $container -Context $ctx -Prefix 2018/Jan

Note, the "folder" is just a prefix to the file. The actual hierachy is quite flat.