The Get-AzDataLakeGen2ChildItem cmdlet lists sub directories and files in a directory or Filesystem in an Azure storage account.
This cmdlet only works if Hierarchical Namespace is enabled for the Storage account. This kind of account can be created by run "New-AzStorageAccount" cmdlet with "-EnableHierarchicalNamespace $true".
Examples
Example 1: List the direct sub items from a Filesystem
This example uses the MaxCount and ContinuationToken parameters to list items recursively from a Filesystem in multiple batches.
A small MaxCount can limit the number of items returned from a single request, may help prevent operation timeout errors, and reduce the memory usage of PowerShell.
The first four commands assign values to variables to use in the example.
The fifth command specifies a Do-While statement that uses the Get-AzDataLakeGen2ChildItem cmdlet to list items.
The statement includes the continuation token stored in the $Token variable.
$Token changes value as the loop runs.
The final command uses the Echo command to display the total.
If specify this parameter, the user identity values returned in the owner and group fields of each list entry will be transformed from Microsoft Entra Object IDs to User Principal Names. If not specify this parameter, the values will be returned as Microsoft Entra Object IDs. Note that group and application Object IDs are not translated because they do not have unique friendly names.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.