I have the following code which gets a collection of the properties of a blob and then uses a foreach loop to locate the selected property value. Is there a bettwer that does not involve looping through the collection in PowerShell 7
$Blobs = Get-AzStorageBlob -Container $containerName -Context $ctx
ForEach ($Blob in $Blobs){
if($Blob.Name.IndexOf($blobName) -ge 0)
{
if (Get-Member -InputObject $Blob.ICloudBlob.Properties -Name $blobPropertyName -MemberType Property) {
$retValue = $Blob.ICloudBlob.Properties.$blobPropertyName
break;
}
} else{
Write-Host "Blob not found!"
}
}