Why does my script quietly end after Get-AzStorageBlobContent?

This is driving me crazy. I have the below script block, and whether I run it in Azure Automation, from a.ps1 file on my machine or interactively in a console, it quietly ends after downloading the json file.

$Subscription = "Azure Subscription"
$RGName = "AzRG"
$SAName = "AzStorAcc"
$Container = "AzContainer"
$JSON = "$(Join-Path $env:TEMP 'json.json')"
Connect-AzAccount -Credential $AZCredentials -Subscription $Subscription -verbose
$CTXFlow = (Get-AzStorageAccount -Name $SAName -ResourceGroupName $RGName).Context
Get-AzStorageBlob -Context $CTXFlow -Container $Container -Prefix "Test" | select -First 1 | Get-AzStorageBlobContent -Destination $JSON -Verbose -Force
Write-Output "Does JSON.JSON exist? $(Test-Path $JSON)" Write-Output "$((GCI $JSON).FullName)"

The file is downloaded fine, and if I run the last two lines manually, they return the expected output.

So, what am I missing here? What is causing the blob download to kill my script?

Interestingly, when passing the found blobs to the pipeline, get-azstorageblob doesn’t actually pass anything on, which for some odd reason cause this.
If I could be bothered, I’d raise an issue on GitHub for it.

Replace write-output with write-verbose.

Write-Verbose "Does JSON.JSON exist? $(Test-Path $JSON)" -Verbose
Write-Verbose "$((GCI $JSON).FullName)" -Verbose

Thanks, but it dies after the Get-azstorageblob command. Also, write-output allows my script to be compatible with Azure Automation, hence why I’m using it.