I'm working on a script to list the blobs in a container which has a ridiculous number of blobs (over 30 million!).
Anyway, I'm using the code from https://learn.microsoft.com/en-us/powershell/module/az.storage/get-azstorageblob?view=azps-3.8.0
Which appears to use a continuation token for every 10,000 files.
$MaxReturn = 10000
$ContainerName = "abc"
$Total = 0
$Token = $Null
do
{
$Blobs = Get-AzStorageBlob -Container $ContainerName -MaxCount $MaxReturn -ContinuationToken $Token
$Total += $Blobs.Count
if($Blobs.Length -le 0) { Break;}
$Token = $Blobs[$blobs.Count -1].ContinuationToken;
}
While ($Token -ne $Null)
Echo "Total $Total blobs in container $ContainerName"
The problem is that this always ends up hanging or getting stuck and never completes.
It usually gets around half way and I have to restart it which kicks off the entire process all over again.
However, I already have the data from the first run, is there a way to get it to start from a specific value rather than from the start?
Lets say I already have the records I need for the first 3 million blobs. How do I tell it to start from 3 million instead of 0?
Or am I not understanding how the process works?