Azure / Azure/azure-powershell

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

Open
#28,504 8 comments 0 reactions 1 assignee Claimed by @blueww View on GitHub
act-codegen-extensibility-squad bug customer-reported Service Attention Storage
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### 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
https://github.com/Azure/autorest.powershell/issues/494
https://github.com/Azure/azure-powershell/issues/10226

### Issue script & Debug output

```PowerShell
In description
```

### Environment data

```PowerShell
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

```PowerShell
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.