Skip to content

Conversation

@amnguye
Copy link
Member

@amnguye amnguye commented Oct 23, 2025

Attempt to address: #49993

In order to ensure polling and scanning operations use the "target" BlobServiceClient specified we had to make changes to how Listeners are added and the BlobListenerStrategy is initialized.

In my attempt here, I did the following:

  • Changed IBlobNotificationStrategy to now take in a "target" BlobServiceClient
    • This updated all the derived *Strategy's as well
  • Updated the PollLogsStrategy check on if "$logs" is enabled on the Blob Storage Account
    • I added a try-catch here because ScanBlobScanLogHybridPollingStrategy will eventually call this down the line to prevent unncessary double calls to GetProperties and SetProperties.
  • Fall back to the primary blob storage account
    • This was done to maintain behavior in the case that users want the primary account to be used

TODO:

  • Write up unit tests
  • Ensure the error code being caught for permissions check is correct, to fall back to primary account

…y.RegisterAsync; Added catch for possible permissions failure to default to primary
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Oct 23, 2025
@wilgert
Copy link

wilgert commented Oct 28, 2025

It would be great if this could be merged and released soon!
We ran into an issue with using a BlobTrigger on a different storage account than the AzureWebJobsStorage.
When processing the message failed it tries to put the message on the poison queue in the storage account that contains the Blob instead of the AzureWebJobsStorage.
Since we authorise with that other storage account using Managed Identity with minimal role assignment (only Blob Data Reader) it causes an unhandled exception that triggers a container restart.

We have also opened a case with Azure Support about this (#2510070050000897).

Trace that show restart

An unhandled exception has occurred. Host is shutting down.

Exceptiont that is logged just before this trace

This request is not authorized to perform this operation using this permission.
RequestId:9b46758f-4003-004e-3179-33e8f1000000
Time:2025-10-02T08:52:12.6087860Z
Status: 403 (This request is not authorized to perform this operation using this permission.)
ErrorCode: AuthorizationPermissionMismatch

Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthorizationPermissionMismatch</Code><Message>This request is not authorized to perform this operation using this permission.
RequestId:9b46758f-4003-004e-3179-33e8f1000000
Time:2025-10-02T08:52:12.6087860Z</Message></Error>

Headers:
Server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 9b46758f-4003-004e-3179-33e8f1000000
x-ms-client-request-id: 8dcac883-be71-40c2-a7ec-c63cc4f2681b
x-ms-version: 2025-01-05
x-ms-error-code: AuthorizationPermissionMismatch
Date: Thu, 02 Oct 2025 08:52:12 GMT
Content-Length: 279
Content-Type: application/xml

Stacktrace for this exception

[
  {
    "assembly": "Azure.Storage.Queues, Version=12.21.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Azure.Storage.Queues.MessagesRestClient+&lt;EnqueueAsync&gt;d__14.MoveNext",
    "level": 0,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 1,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 2,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 3,
    "line": 0
  },
  {
    "assembly": "Azure.Storage.Queues, Version=12.21.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Azure.Storage.Queues.QueueClient+&lt;SendMessageInternal&gt;d__82.MoveNext",
    "level": 4,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 5,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 6,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 7,
    "line": 0
  },
  {
    "assembly": "Azure.Storage.Queues, Version=12.21.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Azure.Storage.Queues.QueueClient+&lt;SendMessageAsync&gt;d__81.MoveNext",
    "level": 8,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 9,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 10,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 11,
    "line": 0
  },
  {
    "assembly": "Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.3.4.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Microsoft.Azure.WebJobs.Extensions.Storage.Common.StorageQueueExtensions+&lt;AddMessageAndCreateIfNotExistsAsync&gt;d__0.MoveNext",
    "level": 12,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 13,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 14,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 15,
    "line": 0
  },
  {
    "assembly": "Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.3.4.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Microsoft.Azure.WebJobs.Host.Queues.QueueProcessor+&lt;CopyMessageToPoisonQueueAsync&gt;d__14.MoveNext",
    "level": 16,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 17,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 18,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 19,
    "line": 0
  },
  {
    "assembly": "Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.3.4.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Microsoft.Azure.WebJobs.Host.Queues.QueueProcessor+&lt;HandlePoisonMessageAsync&gt;d__13.MoveNext",
    "level": 20,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 21,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 22,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 23,
    "line": 0
  },
  {
    "assembly": "Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.3.4.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Microsoft.Azure.WebJobs.Host.Queues.QueueProcessor+&lt;BeginProcessingMessageAsync&gt;d__11.MoveNext",
    "level": 24,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
    "level": 25,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
    "level": 26,
    "line": 0
  },
  {
    "assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
    "level": 27,
    "line": 0
  },
  {
    "assembly": "Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.3.4.0, Culture=neutral, PublicKeyToken=92742159e12e44c8",
    "method": "Microsoft.Azure.WebJobs.Extensions.Storage.Common.Listeners.QueueListener+&lt;ProcessMessageAsync&gt;d__44.MoveNext",
    "level": 28,
    "line": 0
  }
]

See support case #2510070050000897.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants