Azure / Azure/azure-powershell

Get-AzStorageBlob blocks console in interactive mode if an error ocurrs

Open
#24,748 6 comments 0 reactions 2 assignees Claimed by @isra-fel View on GitHub
assembly-conflict bug customer-reported Investigate :mag:
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

I am investigating an unhandled exception in Get-AzStorageBlob. When the error happens, the console gets blocked and you can only regain console control using ctrl+c.

![image](https://github.com/Azure/azure-powershell/assets/9599352/fbfbf21a-cf34-4340-90dc-1bd24f08eeb1)

### Issue script & Debug output

```PowerShell
$ctx = New-AzStorageContext -StorageAccountName $backupUrl.storageAccountName -SasToken $backupUrl.sasToken;

$blobs = Get-AzStorageBlob -Container $backupUrl.container -Context $ctx -Prefix $backupUrl.prefix;
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.20348.2227
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2227
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
PS C:\> Get-Module Az*

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.17.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear...
Script 6.1.3 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountMa...
```

### Error output

```PowerShell
PS C:\> Resolve-AzError

HistoryId: 4

Message : Method not found: 'Azure.Pageable`1
Azure.Storage.Blobs.BlobContainerClient.GetBlobs(Azure.Storage.Blobs.Models.BlobTraits,
Azure.Storage.Blobs.Models.BlobStates, System.String, System.Threading.CancellationToken)'.
StackTrace : at Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand.d__52.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine&
stateMachine)
at Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand.ListBlobsByPrefix
(Int64 taskId, IStorageBlobManagement localChannel, String containerName, String prefix, Func`2
blobFilter, Boolean includeDeleted, Boolean includeVersion)
at Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand.<>c__DisplayClass
55_1.b__0(Int64 taskId)
at Microsoft.WindowsAzure.Commands.Storage.Common.LimitedConcurrencyTaskScheduler.RunTask(Func`2
taskGenerator)
at Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.MissingMethodException
InvocationInfo : {Get-AzStorageBlob}
Line : $blobs = Get-AzStorageBlob -Container $backupUrl.container -Context $ctx -Prefix
$backupUrl.prefix;

Position : At C:\Program Files\WindowsPowerShell\Modules\Sbs\Functions\SbsMssqlPrepareRestoreFiles.ps1:22 char:18
+ ... $blobs = Get-AzStorageBlob -Container $backupUrl.container -Contex ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 4
```

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.