Skip to content

Get-AzStorageBlob drops pipeline output when piped to Select-Object -First 1 (prints table but returns $null) #28504

@Epokhe

Description

@Epokhe

Description

When piping Get-AzStorageBlob to Select-Object -First 1, no object is emitted to the pipeline (assignment becomes $null) even though a formatted table is printed to the console.

(Get-AzStorageBlob -Context $ctx -Container $Container -Prefix $Prefix).Count  # 48

$b = Get-AzStorageBlob -Context $ctx -Container $Container -Prefix $Prefix | Select-Object -First 1  # table is printed to host
$null -eq $b  # True

# Last works
$c = Get-AzStorageBlob -Context $ctx -Container $Container -Prefix $Prefix | Select-Object -Last 1 
$null -eq $c  # False

Looks similar to these two
Azure/autorest.powershell#494
#10226

Issue script & Debug output

In description

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     5.2.0                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig…
Script     1.11.1                Az.Automation                       {Export-AzAutomationDscConfigurati…
Script     9.1.0                 Az.Storage                          {Add-AzRmStorageContainerLegalHold

Error output

In description

Metadata

Metadata

Assignees

Labels

bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions