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.